[GH-ISSUE #1911] How to check outcome of command operation? #965

Closed
opened 2026-03-04 01:50:17 +03:00 by kerem · 0 comments
Owner

Originally created by @KomaGR on GitHub (Feb 22, 2022).
Original GitHub issue: https://github.com/s3fs-fuse/s3fs-fuse/issues/1911

I have a program that uses the s3fs command to programmatically mount and unmount S3 buckets. My problem is that sometimes the user input is mistaken and s3fs does not return an error code even though an error might have happened (e.g., invalid credentials; check commands and output at the end).

I was expecting s3fs to at least not exit with exit code 0 when using the -f option.

Is what I'm trying to do an anti-pattern for s3fs? Should I be doing something else? I considered parsing the output of a mount command but it seemed too complicated to be the only way. Another option would be to parse the output of s3fs -f but I don't want to try guessing what errors might output or if that will be stable across s3fs versions.

Additional Information

Version of s3fs being used (s3fs --version)

Amazon Simple Storage Service File System V1.86 (commit:unknown) with GnuTLS(gcrypt)

Version of fuse being used (pkg-config --modversion fuse, rpm -qi fuse, dpkg -s fuse)

Version: 2.9.9-3

Kernel information (uname -r)

5.11.0-1022-aws

GNU/Linux Distribution, if applicable (cat /etc/os-release)

NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.2 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

s3fs command line used, if applicable

ubuntu@hostname:~$ s3fs -f my-private-bucket bucket-mountpount/ -o iam_role -o connect_timeout=5
[INF] s3fs.cpp:s3fs_init(3493): init v1.86(commit:unknown) with GnuTLS(gcrypt)
[CRT] s3fs.cpp:s3fs_check_service(3883): Failed to connect by sigv4, so retry to connect by signature version 2.
[CRT] s3fs.cpp:s3fs_check_service(3898): invalid credentials(host=https://s3.amazonaws.com) - result of checking service.
ubuntu@hostname:~$ echo $?
0
ubuntu@hostname:~$ s3fs -f 8sadyaw98ry37roiwayfonqwbyf bucket-mountpoint/ -o iam_role -o connect_timeout=5
[INF] s3fs.cpp:s3fs_init(3493): init v1.86(commit:unknown) with GnuTLS(gcrypt)
[CRT] s3fs.cpp:s3fs_check_service(3901): bucket not found(host=https://s3.amazonaws.com) - result of checking service.
ubuntu@hostname:~$ echo $?
0
Originally created by @KomaGR on GitHub (Feb 22, 2022). Original GitHub issue: https://github.com/s3fs-fuse/s3fs-fuse/issues/1911 I have a program that uses the `s3fs` command to programmatically mount and unmount S3 buckets. My problem is that sometimes the user input is mistaken and s3fs does not return an error code even though an error might have happened (e.g., invalid credentials; check commands and output at the end). I was expecting s3fs to at least not exit with exit code `0` when using the `-f` option. Is what I'm trying to do an anti-pattern for s3fs? Should I be doing something else? I considered parsing the output of a `mount` command but it seemed too complicated to be the only way. Another option would be to parse the output of `s3fs -f` but I don't want to try guessing what errors might output or if that will be stable across s3fs versions. ### Additional Information #### Version of s3fs being used (s3fs --version) Amazon Simple Storage Service File System V1.86 (commit:unknown) with GnuTLS(gcrypt) #### Version of fuse being used (pkg-config --modversion fuse, rpm -qi fuse, dpkg -s fuse) Version: 2.9.9-3 #### Kernel information (uname -r) 5.11.0-1022-aws #### GNU/Linux Distribution, if applicable (cat /etc/os-release) ``` NAME="Ubuntu" VERSION="20.04.2 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.2 LTS" VERSION_ID="20.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=focal UBUNTU_CODENAME=focal ``` #### s3fs command line used, if applicable ```sh ubuntu@hostname:~$ s3fs -f my-private-bucket bucket-mountpount/ -o iam_role -o connect_timeout=5 [INF] s3fs.cpp:s3fs_init(3493): init v1.86(commit:unknown) with GnuTLS(gcrypt) [CRT] s3fs.cpp:s3fs_check_service(3883): Failed to connect by sigv4, so retry to connect by signature version 2. [CRT] s3fs.cpp:s3fs_check_service(3898): invalid credentials(host=https://s3.amazonaws.com) - result of checking service. ubuntu@hostname:~$ echo $? 0 ``` ```sh ubuntu@hostname:~$ s3fs -f 8sadyaw98ry37roiwayfonqwbyf bucket-mountpoint/ -o iam_role -o connect_timeout=5 [INF] s3fs.cpp:s3fs_init(3493): init v1.86(commit:unknown) with GnuTLS(gcrypt) [CRT] s3fs.cpp:s3fs_check_service(3901): bucket not found(host=https://s3.amazonaws.com) - result of checking service. ubuntu@hostname:~$ echo $? 0 ```
kerem closed this issue 2026-03-04 01:50:17 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/s3fs-fuse#965
No description provided.