#3906 oschooser.pl misbehaves

1.550
closed-invalid
nobody
None
5
2011-05-03
2011-05-03
Anonymous
No

Running under Apache, I get this:
No #! line at /usr/libexec/webmin/oschooser.pl line 1.
logged in my error log frequently on a clean Webmin install (ie, no defined OS), and Webmin is unable to detect the OS. Because it has to be perl -U under apache, byt oschooser.pl is launched with a system call to perl as defined in perlpath, it then complains because the arguments in the shebang don't match those used to launch the program in the system() call. However, it seems to work fine under 1.5.30 on another system.

I'd like to sugegst that oschooser.pl should just have the perl bang path added so it can be a stand-alone script, and then the system call in webmin-lib.pl can just call it directly. This would impact the setup script, which also needs to call oschooser and may have a new perl path. That, however, could be resolved by moving the run of perlpath.pl in the setup script up to an earlier point in the process.

A possible alternative is that the UnderApache documentation could be made to indicate that /etc/webmin/perlpath needs updated to include the -U, as this also seems to work. But that potentially complicates things like scripts which want to insert perl into things like cron jobs, as now they have to remember to strip off the -U if present. There's a mechanism in place to make stand-alone scripts work fine, so I vote for using it. :)

Discussion

  • Jamie Cameron

    Jamie Cameron - 2011-05-03

    oschooser.pl should never be run via the web though - it is for use only from the command line, and is run via Webmin's setup process. Even if those issues you mentioned were fixed, it wouldn't do anything useful when run from the browser anyway ..

     
  • Jamie Cameron

    Jamie Cameron - 2011-05-03
    • status: open --> closed-invalid
     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2011-05-04

    It's called when I load the index page, apparently to update the detected OS, so maybe that's the bug then. :)

    Steps to reproduce:
    - empty the real_os_* and os_* variables in /etc/webmin/config, (or upgrade the OS version, I think)
    - go to index.cgi

    Special bonus - if you're running under Apache, you get the error in the apache logs, the config variables are never updated and you get a pair of empty parens on the index page. :) Under miniserv, things Just Work.

     
  • Jamie Cameron

    Jamie Cameron - 2011-05-04

    The real issue might be that webmin is not finding perl properly to run oschooser.pl

    Does /etc/webmin/perl-path exist on your system, and if so what does it contain? It should be something like just :

    /usr/bin/perl

     
  • Nobody/Anonymous

    It exists and contains /usr/bin/perl (well, "/usr/bin/perl -U" now, as the bangpath arguments need to match the commandline as well)

    What seems to be going on is a problem with the suid bit, which has to be the case for this Apache instance because I'm not gonna run Apache as root. :) It's related to another enhancement/bug that I need to submit regarding the "." not being in @INC. This is on a RHEL 5.5 system which required the instalation of a suidperl package, and that may somehow be related. Here's some shell output demonstrating the behavior:

    me@host [/home/me]
    $ cat /tmp/test.pl
    print "hello world\n";
    me@host [/home/me]
    $ chmod 0644 /tmp/test.pl
    me@host [/home/me]
    $ perl /tmp/test.pl
    hello world
    me@host [/home/me]
    $ perl -c /tmp/test.pl
    /tmp/test.pl syntax OK
    me@host [/home/me]
    $ chmod u+s /tmp/test.pl
    me@host [/home/me]
    $ perl /tmp/test.pl
    No #! line at /tmp/test.pl line 1.
    me@host [/home/me]
    $ perl -c /tmp/test.pl
    No #! line at /tmp/test.pl line 1.
    me@host [/home/me]
    $ lsb_release -a
    LSB Version: :core-3.1-amd64:core-3.1-ia32:core-3.1-noarch:graphics-3.1-amd64:graphics-3.1-ia32:graphics-3.1-noarch
    Distributor ID: RedHatEnterpriseServer
    Description: Red Hat Enterprise Linux Server release 5.5 (Tikanga)
    Release: 5.5
    Codename: Tikanga

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2011-05-04

    Looking a little more - and setting SourceForge to "remember me" this time ;) - this is described in the section "Switches On the "#!" Line" in the perlsec document. It's news to me, too. :)

     
  • Jamie Cameron

    Jamie Cameron - 2011-05-05

    If you if you just manually change oschooser.pl to have the correct #! line at the start, does that fix the problem?

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks