[opensuse-factory] why are raw scripts forced into /bin/sh instead of user's shell (a Suse patch to bash)
if I type in: while read fn;do ls -l "$fn"; done < <('ls' -1) into bash, I get a listing of files. But if I put that line in a file. It doesn't work. Why? Because of a suse-only patch to disable running such scripts under the user's shell, and only run them under /bin/sh. The above doesn't work under /bin/sh. So why the special suse-only patch to disable bash on such scripts? -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
On Thursday 2013-02-28 04:59, Linda Walsh wrote:
if I type in: while read fn;do ls -l "$fn"; done < <('ls' -1)
into bash, I get a listing of files.
But if I put that line in a file. It doesn't work.
As usual, your bug reporting skills need much improvement. Like, _show_ us the file.
Why? Because of a suse-only patch to disable running such scripts under the user's shell, and only run them under /bin/sh.
What patch is it? Since you obviously know of it, you could have named it, i.e. the filename within the particular osc package.
The above doesn't work under /bin/sh.
/bin/sh only gives you the guarantee of a POSIX shell. It may not recognize bashisms, of which I believe "<(commnad)" is one. -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
Jan Engelhardt wrote:
On Thursday 2013-02-28 04:59, Linda Walsh wrote:
if I type in: while read fn;do ls -l "$fn"; done < <('ls' -1)
into bash, I get a listing of files.
But if I put that line in a file. It doesn't work.
As usual, your bug reporting skills need much improvement. Like, _show_ us the file.
The above line is a sample 'test file' of one that doesn't work when executed under my default /bin/bash shell.
Why? Because of a suse-only patch to disable running such scripts under the user's shell, and only run them under /bin/sh.
What patch is it? Since you obviously know of it, you could have named it, i.e. the filename within the particular osc package.
---- Dunno about which file it is that patches it, but the results are in "execute_cmd..c" around line #5056: /* We have committed to attempting to execute the contents of this file as shell commands. */ #if 1 <<<<<------------Suse only larray = strvec_len(args) + 1; args = strvec_resize(args, larray + 1); for (i = larray - 1; i; i--) args[i] = args[i - 1]; args[0] = savestring(_PATH_BSHELL); args[1] = command; args[larray] = (char *)0; SETOSTYPE (0); /* Some systems use for USG/POSIX semantics */ execve ("/bin/sh", args, env); SETOSTYPE (1); internal_error (_("%s: cannot execute: %s"), command, strerror (errno)); #else initialize_subshell (); set_sigint_handler (); /* Insert the name of this shell into the argument list. */ larray = strvec_len (args) + 1; args = strvec_resize (args, larray + 1); for (i = larray - 1; i; i--) args[i] = args[i - 1]; args[0] = shell_name; args[1] = command; args[larray] = (char *)NULL; if (args[0][0] == '-') args[0]++; #if defined (RESTRICTED_SHELL) if (restricted) change_flag ('r', FLAG_OFF); #endif if (subshell_argv) { /* Can't free subshell_argv[0]; that is shell_name. */ for (i = 1; i < subshell_argc; i++) free (subshell_argv[i]); free (subshell_argv); } dispose_command (currently_executing_command); /* XXX */ currently_executing_command = (COMMAND *)NULL; subshell_argc = larray; subshell_argv = args; subshell_envp = env; unbind_args (); /* remove the positional parameters */ longjmp (subshell_top_level, 1); /*NOTREACHED*/ #endif
The above doesn't work under /bin/sh.
/bin/sh only gives you the guarantee of a POSIX shell. It may not recognize bashisms, of which I believe "<(commnad)" is one.
---- I know that. I'm running under /bin/bash. The code above ignores my currently running shell and runs the command under /bin/sh. -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
Jan Engelhardt wrote:
As usual, your bug reporting skills need much improvement. Like, _show_ us the file.
Um... followup skills, need improvement, much? I posted that code to the bash list and was told that was not the original code and that my distribution had patched it. -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
Am 28.02.2013 20:29, schrieb Linda Walsh:
Jan Engelhardt wrote:
As usual, your bug reporting skills need much improvement. Like, _show_ us the file.
Um... followup skills, need improvement, much?
I posted that code to the bash list and was told that was not the original code and that my distribution had patched it.
And *that* would have been useful information from the start. Greetings, Stephan -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
On Thursday 28 February 2013, Stephan Kulow wrote:
Am 28.02.2013 20:29, schrieb Linda Walsh:
Jan Engelhardt wrote:
As usual, your bug reporting skills need much improvement. Like, _show_ us the file.
-----------
Um... followup skills, need improvement, much?
I posted that code to the bash list and was told that was not the original code and that my distribution had patched it.
And *that* would have been useful information from the start.
On the other hand she started by saying that this is about a "suse only patch". Is it really important who has told her that this is not original? cu, Rudi -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
On 02/27/2013 09:59 PM, Linda Walsh wrote:
if I type in: while read fn;do ls -l "$fn"; done < <('ls' -1)
into bash, I get a listing of files.
But if I put that line in a file. It doesn't work.
Why? Because of a suse-only patch to disable running such scripts under the user's shell, and only run them under /bin/sh.
The above doesn't work under /bin/sh.
So why the special suse-only patch to disable bash on such scripts?
Why do you think this is SUSE only. Every distro has a default shell, which is what you get when you do not specify the shell to use. Do you know about the shebang? Try the following in a file, and see what you get: #!/bin/bash while read fn ; do ls -l "$fn"; done < <('ls' -1) Larry -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org
participants (5)
-
Jan Engelhardt
-
Larry Finger
-
Linda Walsh
-
Ruediger Meier
-
Stephan Kulow