Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed inconsistent parsing of --mode flag #512

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

sfc-gh-psmolenski
Copy link
Collaborator

Due to default Go's sting-to-int parsing algorithm the value of --mode flag was treated as decimal or octal depending on its format (777 vs. 0777), which was yielding unexpected results and was inconsistent with how native UNIX tools work (e.g. chmod) .

From now on, sanssh client will always treat --mode flag value as a 12-bit octal number.

@sfc-gh-psmolenski sfc-gh-psmolenski added the bug Something isn't working label Nov 15, 2024
@sfc-gh-psmolenski sfc-gh-psmolenski marked this pull request as ready for review November 15, 2024 10:48
Copy link
Collaborator

@sfc-gh-mwalas sfc-gh-mwalas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nits and testing suggestion, LGTM

services/localfile/client/utils.go Outdated Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the sanssh is at least covered with integration test

run_a_test false 0 file chmod --mode="${EXPECTED_NEW_MODE}" ${LOGS}/test-file

Have you tried running / extending those?

(I should look into that for exec run too, but that one might be little bit more challenging as setup requires to have some user structure established

run_a_test false 1 exec run /usr/bin/echo Hello World
)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll check

services/localfile/client/client.go Outdated Show resolved Hide resolved
services/localfile/client/client.go Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants