LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Apparent fairly inconsequential little typo in setup script, perhaps "just to confuse the Russians"? (https://www.linuxquestions.org/questions/slackware-14/apparent-fairly-inconsequential-little-typo-in-setup-script-perhaps-just-to-confuse-the-russians-4175586988/)

luvr 08-13-2016 02:25 PM

Apparent fairly inconsequential little typo in setup script, perhaps "just to confuse the Russians"?
 
While studying the Slackware-64 14.2 'setup' script, I noticed something that looks a little weird to me, and that seems to be a little (and, admittedly, pretty innocent) typo.

Near the end of the script, lines 399 to 403 contain the following dialog command:
Code:

    dialog \
    --clear \
    --title "Slackware Linux Setup is complete" "$@" \
    --msgbox "\nPlease remove the installation disc.\n" 7 40

The "$@" parameter (highlighted in the code snippet above) does not seem to belong there, IMHO. Indeed, the command will fail if the 'setup' script is ever run with any command-line arguments, since they will then get expanded into the above dialog command, and they have no place there.

The same weirdness, by the way, is repeated on the dialog command on lines 405 to 409:
Code:

  dialog \
    --title "Slackware Linux Setup is complete" "$@" \
    --yesno \
    "\nWould you like to reboot your system?\n\n\n\
If you choose \"No\", you will be dropped to a shell.\n" 11 50

Kind of reminded me of superfluous assembly-language instructions that, according to the source-code comments, used to get inserted "Just to confuse the Russians"... :scratch:

drmozes 08-13-2016 03:00 PM

Quote:

Originally Posted by luvr (Post 5590404)
Code:

    dialog \
    --clear \
    --title "Slackware Linux Setup is complete" "$@" \
    --msgbox "\nPlease remove the installation disc.\n" 7 40


As you say, this would pass whatever the "setup" script received as command line input itself, and pass those to the dialog script.
I'm guessing that one of uses for this would be for an automated installer (which alienBOB and I discussed some time ago, and we both had good ideas of how to do it, but not the time) - you have a manual/auto mode; so basically you'd supply the appropriate set of dialog commands to automate default actions such as "Switch RTC check off" -- make it as if the user had pressed "off", etc. It might also have been for some debugging from ages ago.
It's probably the latter, to be honest based on what I know of the installer.


On automation within the installer (which I'd love to have): of course a new automated path could make its own call outs and it wouldn't need user responses, but then we'd have to write an entirely new code path when it's easier to supply dialog with defaults and use the existing, working one.
That code in the installer is all a bit fragile and old style code. When I added that "Reboot your system" thing for ARM, it took me a while to get it working in the right order and even then I did a fair amount of combination testing. After all you didn't want to get in a muddle right before you want to use the OS you just installed! ;-)

luvr 08-14-2016 03:47 PM

Quote:

Originally Posted by drmozes (Post 5590419)
I'm guessing that one of uses for this would be for an automated installer (which alienBOB and I discussed some time ago, and we both had good ideas of how to do it, but not the time) - you have a manual/auto mode; so basically you'd supply the appropriate set of dialog commands to automate default actions such as "Switch RTC check off" -- make it as if the user had pressed "off", etc.

I get that, but the thing is that the dialog command will fail if the "$@" construct ever produces anything. Under normal circumstances, however, it won't hurt, since nothing will get produced if no command-line arguments were passed to the setup script, so in practice, it will mostly go by unnoticed anyway.

Quote:

It might also have been for some debugging from ages ago.
It's probably the latter, to be honest based on what I know of the installer.
Probably, yes. It sure looks like something that I would do, too.


All times are GMT -5. The time now is 07:18 PM.