Re: [Bashburn-info] Install.sh options
Brought to you by:
bashburn
From: Steven W. O. <st...@sy...> - 2008-09-29 17:05:26
|
On Monday, Sep 29th 2008 at 12:54 -0000, quoth Nick Warne: =>On Mon, 29 Sep 2008 11:21:52 -0400 (EDT) =>"Steven W. Orr" <st...@sy...> wrote: => =>> On Monday, Sep 29th 2008 at 09:18 -0000, quoth Steven W. Orr: =>> =>> =>On Monday, Sep 29th 2008 at 06:37 -0000, quoth Nick Warne: =>> => =>> =>=> =>> =>=>I have hardened the Install file options, after I noticed some =>> strange =>=>behaviour with silly options (i.e. -uninstall ). =>> =>=> =>> =>=>There is still a big issue if you use: =>> =>=> =>> =>=>-prefix=/usr =>> =>=> =>> =>=>The install script will install into a directory called 'refix' =>> in the =>=>current directory. =>> =>=> =>> =>=>Nick =>> => =>> =>That should not happen. I'll look at it. :-( (after svn comes back =>> up) =>> =>> Nick, I haven't seen the change you made, but let me explain what's =>> happening. =>> =>> The getopt/getopts calls are SVR4 compliant. That means that if you =>> have a bunch of legal options, like a, b and c, then =>> =>> foo -abc =>> is the same as =>> =>> foo -a -b -c =>> =>> In this case, we have long options. Every longopt has to have a =>> corresponding single letter option (to be SVR4 complient). In this =>> case, we have -p and -u and -h. They have --prefix, --uninstall, and =>> --help as long version. =>> =>> The -p takes an argument, so if you say =>> =>> Install.sh -prefix =>> =>> then you get what the doctor ordered. You get -p with an option arg =>> of refix. We probably should not be coding defensively around that. =>> If the user was going to use the long option correctly then he would =>> say =>> =>> Install.sh --prefix dirname =>> or =>> Install.sh --prefix=dirname =>> =>> But to just say -prefix is just wrong as the basis for something we =>> should worry about. =>> =>> Also note, if you say -p with no arg then that is caught as an error. =>> =>> Does this help? =>> => =>Well, I find it a bit brain dead if a user mistypes '--prefix' as =>'-prefix' and it installs into a directory called 'refix'. => =>BTW, SVN is back up yabut your solution seems to imply that short options should be constrained to uppercase (even if they *don't* take an argument). Remember that creating options is not just a question of SVR4 compatibility; it's also a question of following conventions to make it more familiar. e.g., -h == help -v == verbose -V == Version info -c == alternate configfile -d == directory spec -i == install -l == long output -n == don't do it but tell me what you want to do -o == output -q == query status returned -R == recurse -t == set a type -u == uninstall -- steveo at syslang dot net TMMP1 http://frambors.syslang.net/ Do you have neighbors who are not frambors? Steven W. Orr |