It doesn't work without a space



  • At work we use a certain install authoring tool.  It has a way to let you run an arbitrary utility before the main installation (we use it to check extra system requirements).  After a nice back and forth about some problems it turns out that if the path to the utility on the build server has a space in it then the name of the variable (in the tool's proprietary scripting language) must also have a space.  And if the path does not have a space then the variable must not have a space either.  The explaination is that if the variable's name does not have a space then it stores it one way, and if it has a space then it stores it another way.  Can someone explain that?  I thought a string was a string.



  • [quote user="Cotillion"]At work we use a certain install authoring tool.  It has a way to let you run an arbitrary utility before the main installation (we use it to check extra system requirements).  After a nice back and forth about some problems it turns out that if the path to the utility on the build server has a space in it then the name of the variable (in the tool's proprietary scripting language) must also have a space.  And if the path does not have a space then the variable must not have a space either.  The explaination is that if the variable's name does not have a space then it stores it one way, and if it has a space then it stores it another way.  Can someone explain that?  I thought a string was a string.
    [/quote]

     

    It's wtf'd up, but it probably has something to do with appending "'s at the begining and end of the path so that it can be passed as an argument to a program and be seen as one argument. 



  • I thought that too but it doesn't solve it.  If the utility is at C:\SVN Dev\Executable.exe then the error says that it can't find "C:\SVN" (without quotes).  If I include quotes then it says it can't find "C:\SVN Dev\Executable.exe" (including quotes).  It looks like it includes the quotes (if you use them) as part of the path.



  • [quote user="Cotillion"]I thought that too but it doesn't solve it.  If the utility is at C:\SVN Dev\Executable.exe then the error says that it can't find "C:\SVN" (without quotes).  If I include quotes then it says it can't find "C:\SVN Dev\Executable.exe" (including quotes).  It looks like it includes the quotes (if you use them) as part of the path.
    [/quote]

     

    Well, since they are the ones doing the quoting, it looks like they don't expect you to quote the string, hence why you still get errors when you try to work around it. Still very interesting.... I would love to see that WTF'd up code they got, cuz it's obviously FUBAR. 



  • WHAT THE FUCK kind of scripting language lets you put a SPACE in a variable name?  



  • [quote user="tster"]WHAT THE FUCK kind of scripting language lets you put a SPACE in a variable name?  
    [/quote]

    i:\dev>perl -e "${'h a'}=42; print ${'h a'};"
    42
    i:\dev>

    Perl does. OK, so that uses a very peculiar syntax, not one that most people would normally use. (${'var'} is another name for $var).



  • it turns out that if the path to the utility on the build server has a space in it then the name of the variable (in the tool's proprietary scripting language) must also have a space.

    But ...isn't this obvious?

    I mean, if there's a util, and it has the path, say,  "\Program Files\Super Tool.exe" then you can [i]expect[/i] it to not work if you set the preference with "\ProgramFiles\SuperTool.exe".

    What's the surprise? "Hey, if I misspell the path, it doesn't work anymore! What gives!"

    What am I missing?
     



  • [quote user="dhromed"]

    What's the surprise? "Hey, if I misspell the path, it doesn't work anymore! What gives!"

    What am I missing? [/quote]

     

    He's saying that, in your example with a path of "\Program Files\Super Tool.exe", the variable name must contain a space - eg "$path Name" rather than "$pathName". Likewise, if the path doesn't contain a space, eg "\tools\myTool.exe", then the variable name mustn't either - so "$pathName" would work, but "$path Name" wouldn't.

     Seriously fubar code they have there.
     



  • [quote user="Cloaked User"][quote user="dhromed"]

    What's the surprise? "Hey, if I misspell the path, it doesn't work anymore! What gives!"

    What am I missing? [/quote]

     

    He's saying that, in your example with a path of "\Program Files\Super Tool.exe", the variable name must contain a space - eg "$path Name" rather than "$pathName". Likewise, if the path doesn't contain a space, eg "\tools\myTool.exe", then the variable name mustn't either - so "$pathName" would work, but "$path Name" wouldn't.

     Seriously fubar code they have there.
     

    [/quote]

     It's gotta be something retarded where they check if the variable without a space is assigned to, and if it is, they use that without quotes. If it's not assigned, they quote the one with the space and use that.... If that's not it then they are just uber-tarded, because I can't see any other scenario making even WTF'd up sense. Of course, i'm not saying that what they're doing isn't WTF'd up... By far it's definitely one of the most WTF'd up things I've heard of in a production tool.
     



  • [quote user="Cloaked User"][quote user="dhromed"]

    What's the surprise? "Hey, if I misspell the path, it doesn't work anymore! What gives!"

    What am I missing? [/quote]

     

    He's saying that, in your example with a path of "\Program Files\Super Tool.exe", the variable name must contain a space - eg "$path Name" rather than "$pathName". Likewise, if the path doesn't contain a space, eg "\tools\myTool.exe", then the variable name mustn't either - so "$pathName" would work, but "$path Name" wouldn't.

    Seriously fubar code they have there.

    [/quote]

    ahhhhhh

    JScript/Javascript (an perhaps many other languages other than Perl) support the property-as-string syntax.

    eg.

    Object.someproperty;

    is

    Object['someproperty'];

    My god that's so nice to abuse. I've done it once.

    Object['This is a very specific key'];

    And then I rinsed my hands like a surgeon with OCD, broke my keyboard and bought a new computer.
     



  • [quote user="Bellinghman"][quote user="tster"]WHAT THE FUCK kind of scripting language lets you put a SPACE in a variable name?  
    [/quote]

    i:\dev>perl -e "${'h a'}=42; print ${'h a'};"
    42
    i:\dev>

    Perl does. OK, so that uses a very peculiar syntax, not one that most people would normally use. (${'var'} is another name for $var).
    [/quote]

    If you use that syntax under "strict" (which any real perl script should be using), as in:

     

    perl -Mstrict -e "${'h a'}=42; print ${'h a'};"

    then Perl will bitchslap you for it.

     



  • @dhromed said:

    [quote user="Cloaked User"][quote user="dhromed"]

    What's the surprise? "Hey, if I misspell the path, it doesn't work anymore! What gives!"

    What am I missing?

     

    He's saying that, in your example with a path of "\Program Files\Super Tool.exe", the variable name must contain a space - eg "$path Name" rather than "$pathName". Likewise, if the path doesn't contain a space, eg "\tools\myTool.exe", then the variable name mustn't either - so "$pathName" would work, but "$path Name" wouldn't.

    Seriously fubar code they have there.

    [/quote]

    ahhhhhh

    JScript/Javascript (an perhaps many other languages other than Perl) support the property-as-string syntax.

    eg.

    Object.someproperty;

    is

    Object['someproperty'];

    My god that's so nice to abuse. I've done it once.

    Object['This is a very specific key'];

    And then I rinsed my hands like a surgeon with OCD, broke my keyboard and bought a new computer.
     

    [/quote]

    Yeah except that last time I checked you had no way of using the dotted syntax when you have spaces in your hash key, so you get strictly nothing more than a regular hash.



  • [quote user="Oliver Klozoff"][quote user="Bellinghman"][quote user="tster"]WHAT THE FUCK kind of scripting language lets you put a SPACE in a variable name?  
    [/quote]

    i:\dev>perl -e "${'h a'}=42; print ${'h a'};"
    42
    i:\dev>

    Perl does. OK, so that uses a very peculiar syntax, not one that most people would normally use. (${'var'} is another name for $var).
    [/quote]

    If you use that syntax under "strict" (which any real perl script should be using), as in:

     

    perl -Mstrict -e "${'h a'}=42; print ${'h a'};"

    then Perl will bitchslap you for it.

     

    [/quote]

     

    This is the language where the bugs section of the man page starts with "The -w switch is not mandatory".

     



  • [quote user="Cloaked User"]

    Seriously fubar code they have there.
    [/quote]

    It looks very simple to me. Let vn be the variable name and pn be the pathname.

        if(Contains_Space(vn)) vn = Properly_Escape(vn);

    All well and good! Copy and paste, then edit:

        if(Contains_Space(vn)) pn = Properly_Escape(pn);

    Notice that Contains_Space() is still operating on vn. This single-letter error causes the behavior described above.


Log in to reply