From e9919b0bfd00c7d228531ebafa410cbfdafcb2e3 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 9 May 2020 14:52:06 -0700 Subject: actions/config: improve config file related errors ErrBadConfig: Fix backwards wrapping, include the bad config, and make it clear that this is an internal error. ErrBadConfigFile: Fix backwards wrapping, include the config file location, and adjust the suggestion slightly. ErrConfigFileExists: Include the config file location. ErrNoConfigFile: Include the config file location, and adjust the suggestion slightly. --- cli-tests/t_setup.out | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'cli-tests/t_setup.out') diff --git a/cli-tests/t_setup.out b/cli-tests/t_setup.out index e1606ba..7d597bd 100644 --- a/cli-tests/t_setup.out +++ b/cli-tests/t_setup.out @@ -38,12 +38,12 @@ Metadata directories created at "MNT/.fscrypt". with fscrypt # no config file -[ERROR] fscrypt setup: global config file does not exist +[ERROR] fscrypt setup: "FSCRYPT_CONF" doesn't exist -Run "sudo fscrypt setup" to create the file. +Run "sudo fscrypt setup" to create this file. # bad config file -[ERROR] fscrypt setup: invalid character 'b' looking for beginning of value: - global config file has invalid data +[ERROR] fscrypt setup: "FSCRYPT_CONF" is invalid: invalid + character 'b' looking for beginning of value -Run "sudo fscrypt setup" to recreate the file. +Either fix this file manually, or run "sudo fscrypt setup" to recreate it. -- cgit v1.2.3 From 66fb4c557644ba2c37951a7568c06c47a6c718a7 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 9 May 2020 14:52:07 -0700 Subject: filesystem: improve errors Introduce filesystem.ErrEncryptionNotEnabled and filesystem.ErrEncryptionNotSupported which include the Mount as context, and translate the corresponding metadata/ errors into them. Then make these errors show much better suggestions. Also replace lots of other filesystem/ errors with either custom types or with unnamed one-off errors that include more context. Fix backwards wrapping in lots of cases. Finally, don't include the mountpoint in places where it's not useful, like OS-level errors that already include the path. --- cli-tests/t_setup.out | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cli-tests/t_setup.out') diff --git a/cli-tests/t_setup.out b/cli-tests/t_setup.out index 7d597bd..ef0d133 100644 --- a/cli-tests/t_setup.out +++ b/cli-tests/t_setup.out @@ -34,8 +34,8 @@ Use --force to automatically run destructive operations. Metadata directories created at "MNT/.fscrypt". # fscrypt setup filesystem (already set up) -[ERROR] fscrypt setup: filesystem MNT: already setup for use - with fscrypt +[ERROR] fscrypt setup: filesystem MNT is already setup for + use with fscrypt # no config file [ERROR] fscrypt setup: "FSCRYPT_CONF" doesn't exist -- cgit v1.2.3 From 181600d6327ed34a3f62eda0dd03a6d2ae49e5f9 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 9 May 2020 14:52:07 -0700 Subject: cmd/fscrypt: improve errors In checkEncryptable(), check whether the directory is already encrypted before checking whether it's empty. Also improve the error message for when a directory is nonempty. Finally, translate keyring.ErrKeyAddedByOtherUsers and keyring.ErrKeyFilesOpen into errors which include the directory. --- cli-tests/t_setup.out | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cli-tests/t_setup.out') diff --git a/cli-tests/t_setup.out b/cli-tests/t_setup.out index ef0d133..943a781 100644 --- a/cli-tests/t_setup.out +++ b/cli-tests/t_setup.out @@ -26,7 +26,7 @@ Skipping creating MNT_ROOT/.fscrypt because it already exists. # fscrypt setup --quiet when fscrypt.conf already exists [ERROR] fscrypt setup: operation would be destructive -Use --force to automatically run destructive operations. +If desired, use --force to automatically run destructive operations. # fscrypt setup --quiet --force when fscrypt.conf already exists -- cgit v1.2.3