Bug 75751
Summary: | switchdesk writes invalid shell script | ||
---|---|---|---|
Product: | [Retired] Red Hat Linux | Reporter: | Need Real Name <vader> |
Component: | switchdesk | Assignee: | Than Ngo <than> |
Status: | CLOSED RAWHIDE | QA Contact: | David Lawrence <dkl> |
Severity: | medium | Docs Contact: | |
Priority: | low | ||
Version: | 8.0 | CC: | behdad, mitr |
Target Milestone: | --- | Keywords: | EasyFix |
Target Release: | --- | ||
Hardware: | i386 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2004-02-03 20:51:23 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Need Real Name
2002-10-11 20:18:46 UTC
Scripts which do not have a shebang are perfectly technically correct. The OS uses the default shell automatically. However, it isn't a big deal to add a shebang, so I'll add #!/bin/bash which is our official system shell (and not /bin/sh) Also, I might as well note in case you're a purist... /bin/sh is linked to bash on Red Hat Linux: [mharris@devel BUILD]$ dir /bin/sh lrwxrwxrwx 1 root root 4 Sep 26 02:23 /bin/sh -> bash ... so, it makes no difference which is there as the same shell gets used in either case. Again, bash is the supported system shell, so that is what we care about being there. (Clarifying so as to avoid a pointless /bin/sh purist debate which will end up in me doing what I've decided to do anyway) mharris wrote: Also, I might as well note in case you're a purist... /bin/sh is linked to bash on Red Hat Linux: [mharris@devel BUILD]$ dir /bin/sh lrwxrwxrwx 1 root root 4 Sep 26 02:23 /bin/sh -> bash ************************ Yes, I know that sh is linked to bash -- I wasn't filing the report on 'purist' grounds, so no need to worry there. ;) Thanks for clarifying the other issue regarding lack of an interpreter line. I'm not a purist, but I'll play one here ;-) u-pl6:~/BIG/translate$ /bin/bash u-pl6:~$ set |grep POSIX u-pl6:~$ exit u-pl6:~/BIG/translate$ /bin/sh u-pl6:~/BIG/translate$ set |grep POSIX POSIXLY_CORRECT=y u-pl6:~/BIG/translate$ exit bash changes its behavior depending on whether it was invoked as bash or sh That's not a surprise. It is documented behaviour and should be present in the bash manpage. When invoked as /bin/sh or with POSIXLY_CORRECT, bash will definitely behave differently. I still think it would have been nice if RMS would have called it POSIX_ME_HARDER like he wanted to originally though. Mike, you are not completely right. I'm closing this old bug, as your could would work anyway. But about shebang's being technically optional, I'm afraid not. It's the shell that defaults to /bin/sh. If you use exec set of functions, it would not work without shebang. Here's an example: Compile this one as 'a': #include <unistd.h> void main() { execl("./x", "x", 0); } and write a simple script x: echo "I'm x". and try ./a, you see nothing. Now add shebang to x, try ./a, you see the output. Would you close then. I can't. That isn't the proper way to invoke a shell script from a C program. No surprise there. Let's please not waste each other's time with a totally pointless debate in a bug report though. The purpose of this report ultimately is to request that a shebang be added to a script because it is missing. I will do that probably in good time if it isn't done already, but it's a rather low priority issue. The bug can stay open until someone fixes it. Part of the reason switchdesk bugs are low priority is because we'd like to completely remove switchdesk, but for some reason or another it keeps sticking around. ;o) The switchdesk CVS repo is also screwed up IIRC. Just FYI, the proper way to invoke a shell script, is with the interpreter as the first argument to exec*() Anyway, all of the information required to fix and close this bug report is within the bug report, no further comments are needed from anyone. Thanks for pinging me on it though. Adding to tracker it's fixed in 4.0.0, which is available in rawhide. |