-
-
Notifications
You must be signed in to change notification settings - Fork 42
Tickets #2325 & #4480: cd into directories with long names and/or embedded \n #4804
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
base: master
Are you sure you want to change the base?
Tickets #2325 & #4480: cd into directories with long names and/or embedded \n #4804
Conversation
ceeb70e to
d6b260d
Compare
|
Oops, I've accidentally pushed the branch into the main mc repo; I didn't mean that. Sorry for that! You can remove that branch if you wish. |
|
Nevermind, I've deleted it. Sorry for the noise. |
|
There's a regression with tcsh: Previously it could enter directories with a non-alphanumeric UTF-8 symbol (e.g. heart Let me play around a little bit with tcsh to see if I can fix this. Let's hold off this PR for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3nd commit msg: typo in 'platforms'
57e9ac6 to
d267252
Compare
|
Back to tcsh: I think I can do either of these two things:
So it's either-or: invalid UTF-8 but no newlines, or newlines but not invalid UTF-8. And no, I'm not going to implement both and pick runtime so that we only fail if a path contains both :) Which one do you guys vote for? |
|
tcsh: I was wrong, command substitution isn't binary safe either. So, without terrible hacks, I can get newline working but not invalid UTF-8. To get invalid UTF-8 working, I think this would do it:
and when a command completes and tcsh sends it working directory to mc, invoke the external I'm not gonna do this, it's just not worth it. |
My thinking is that if I had to choose, I'd take newlines. |
d267252 to
eefcf8c
Compare
|
Yup I'm going with newlines. New commit pushed to fix regression with tcsh. How confident are we that placing unquoted 128..255 bytes in the command line is safe in every shell, they don't have any special meaning in the shell? |
eefcf8c to
013cd52
Compare
|
New ideas for fully fixing But let's not do everything in this PR, let's leave that for another day. Pushed an unchanged version, just rebase. Please review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In as far as I'm concerned, I'm satisfied with the current state. I have to admit that neither have I looked at the code too closely, nor have I tested it on my machines, but I really like the new structure and the documentation around it.
Just as a general comment, if I leave line comments with just one statement (and not more than one sentence), it looks better to me to omit the final full stop. Which is of course not pursued consistently throughout the whole codebase due to age.
… the subshell If the subshell writes the working directory slowly, previously we could read its beginning and stop there. Signed-off-by: Egmont Koblinger <egmont@gmail.com>
This piece of code was never live in mc. It would work around a BusyBox bug that was fixed in 2012. Signed-off-by: Egmont Koblinger <egmont@gmail.com>
…ng a directory with special characters Handle trailing '\n' character in the directory name. Make sure to construct the cd command in physical lines no longer than 250 bytes so that we don't hit the small limit of the kernel's cooked mode tty buffer size on some platforms. tcsh still has problems entering directories with special characters (including invalid UTF-8) in their name. Other shells are now believed to handle any directory name properly. Signed-off-by: Egmont Koblinger <egmont@gmail.com>
…ibyte UTF-8 Don't escape safe shell characters commonly used in paths, such as '/', '.', '-' and '_'. Don't escape multibyte UTF-8 characters. Escaping each byte separately in string assignments doesn't work in tcsh. The previous commit introduces a regression here: tcsh cannot enter directories whose name is valid UTF-8 but contains non-alphanumeric UTF-8 characters. It used to work because printf would glue them together correctly, but we no longer use printf and command substitution because that breaks newlines. Signed-off-by: Egmont Koblinger <egmont@gmail.com>
013cd52 to
051cf0f
Compare
|
/rebase
I myself am inconsistent with that, too. Also whether to begin with uppercase or lowercase. Fixed one such occurrence. In the last commit, there's a one-liner and a two-liner that I'd like to keep consistent, so I kept the trailing dot. |
Proposed changes
More robust reading of pwd, namely:
Checklist
👉 Our coding style can be found here: https://midnight-commander.org/coding-style/ 👈
git commit --amend -smake indent && make check)