Red Hat Bugzilla – Bug 1480307
behavior change in "cd f*"
Last modified: 2017-08-11 10:40:19 EDT
Description of problem:
cd wildcard behavior change from fedora 25. Now, multiple dirs (f12, f13, f14) when the first is desired this "cd f*" returns "bash: cd: too many arguments"
Previous behavior took you into f12 directory.
Version-Release number of selected component (if applicable):
Bash version: bash.x86_64 4.4.12-6.fc26
Steps to Reproduce:
This seems to be built-time configurable:
Note that no wildcard is needed to get the fatal error. It triggers whenever 'cd' gets more than one arguments.
It makes sense to show error message if multiple arguments are passed to 'cd'. Why do you think it's a bug ?
It is a bug because this is a fundamental change in behavior with respect to wilecards.
I, and I suspect others as well, use the wildcard as a shorthand method of specifying the first directory in a list of similar names. For interactive use, going to the wrong directory is quickly obvious and for scripts, I doubt wildcard usage is common.
Now, in terms of implementation on the system, Fedora 26 has introduced several difficulties with a simple, core command:
There is no longer a standalone cd command on the system:
(/bin/cd and /usr/bin/cd contain the same code)
$> cat /usr/bin/cd
builtin cd "$@"
Problems as I see them:
/bin/sh is not the correct shell in general terms it's a symlink after all,
/bin/bash is specific and has the builtin.
$@ is already expanded by the calling shell, so the new instance of bash
does not realize that this is a wildcard request.
It is not a behavior change with wildcards. It is a change in terms of how 'cd' builtin handles it's arguments. It is non-intuitive to pass multiple arguments to cd builtin and expect it to ignore all arguments except first one. I fail to see how the example about '/usr/bin/cd' relates to this behavior. This behavior change was introduced with this commit. The script under /usr/bin/cd is provided for POSIX compliance (See bug 820192) and was present before Fedora 26.
We will just have to agree to disagree on this issue. Strict enforcement does not necessarily make it right or acceptable to everyone.