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

Fail to move when using non-EN locale #49

Open
SamuNatsu opened this issue Mar 5, 2025 · 3 comments
Open

Fail to move when using non-EN locale #49

SamuNatsu opened this issue Mar 5, 2025 · 3 comments

Comments

@SamuNatsu
Copy link

Lines here only works on English locales:

if [[ $OUT =~ "Permission denied" ]]; then

If the user uses other locales (e.g. Chinese), there's no Permission denied string in the output, instead a 权限不够.

So maybe we should try other methods to check whether move fails by permission denied.

@SamuNatsu
Copy link
Author

Maybe we can use strace mv $FROM $TO 2>&1 | grep 'EPERM\|EACCES' to check whether move failed by operation not permitted or permission denied, instead of just checking the output string.

@jpillora
Copy link
Owner

jpillora commented Mar 5, 2025 via email

@SamuNatsu
Copy link
Author

Not really, for some other distributions it should be installed manually.

Another solution is to use ‘ls‘ and username to check whether user is the owner of target folder. Naive but less dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants