#11602: install_scripts should use "$@" instead of $*
------------------------------+---------------------------------------------
   Reporter:  Stefan          |          Owner:  jason                          
  
       Type:  defect          |         Status:  needs_review                   
  
   Priority:  minor           |      Milestone:  sage-4.7.2                     
  
  Component:  misc            |       Keywords:  install_scripts, hg, command 
line
Work_issues:                  |       Upstream:  N/A                            
  
   Reviewer:  Leif Leonhardy  |         Author:  John Palmieri                  
  
     Merged:                  |   Dependencies:                                 
  
------------------------------+---------------------------------------------

Old description:

> When using a script created by Sage's install_scripts() function,
> parameters with spaces cause problems. Example:
> {{{
> From sage:
>
> sage: os.mkdir("temp")
> sage: install_scripts("temp")
> sage: quit
>
> From shell:
>
> $ cd temp
> $ mkdir hgtest
> $ cd hgtest
> $ ../hg init
> $ ../hg commit -m"Two words"
> abort: words: No such file or directory
> $ ../hg commit -m"Oneword"
> nothing changed
> }}}
>
> Apparently this was discussed on the mailing list back in 2008:
> https://groups.google.com/forum/#!msg/sage-devel/oeFrvqWiP_s/o8mKO-4OAKkJ
>
> It seems that the solution is to make install_scripts write "$@" instead
> of $* .
>
> --------
>
> Apply [attachment:trac_11602-install-scripts.v2.patch].

New description:

 When using a script created by Sage's install_scripts() function,
 parameters with spaces cause problems. Example:
 {{{
 From sage:

 sage: os.mkdir("temp")
 sage: install_scripts("temp")
 sage: quit

 From shell:

 $ cd temp
 $ mkdir hgtest
 $ cd hgtest
 $ ../hg init
 $ ../hg commit -m"Two words"
 abort: words: No such file or directory
 $ ../hg commit -m"Oneword"
 nothing changed
 }}}

 Apparently this was discussed on the mailing list back in 2008:
 https://groups.google.com/forum/#!msg/sage-devel/oeFrvqWiP_s/o8mKO-4OAKkJ

 It seems that the solution is to make install_scripts write "$@" instead
 of $* .

 --------

 Apply [attachment:trac_11602-install-scripts.v3.patch].

--

Comment(by jhpalmieri):

 Replying to [comment:22 leif]:

 > Just double-backquotes (monospaced font) would have sufficed.

 Well, it is a string, so it's nice to explicitly include the single quotes
 in the html version of the reference manual.

 > The docstring actually lacks a description of what a shortcut [script]
 is or really / technically does; an example saying that the scripts make
 e.g. `gp` an alias for `sage -gp`, which starts the stand-alone PARI/GP
 interpreter, would be helpful.

 I expanded this, perhaps too much.

 > When talking about ''software components'', I'd use their ''name''
 rather than the corresponding command, i.e. GAP, Maxima, Singular,
 PARI/GP, MWrank (?), Mercurial, GNU R etc., without quotes. In contrast,
 when referring to the commands / options to `sage`, I'd typeset them as
 such (with double-backticks), but also omit single-quotes visible in the
 HTML documentation.

 See the new patch.

 > I'd also typeset `root` and `sage` (lower-case) monospaced in

 Okay.

 > and perhaps mention `sudo` or `sudo sage -c
 "install_scripts(<directory>)"`, or combine it with the next sentence,
 giving the example {{{sudo sage -c "install_scripts('/usr/local/bin')"}}}

 Okay

 > (Do you want to add a "shortcut script" `install_scripts` to
 `$SAGE_ROOT/local/bin/` or `$SAGE_ROOT/`? :P )

 No.

 > We should check once in advance that the given directory is writable by
 the user, right after the presence test, in order to give a nice(r) error
 message [earlier].

 Right.

 > Btw., I still get an ugly traceback if the directory doesn't exist; can
 we suppress that or do we really have to `raise`? (I'd prefer just
 printing an error message and `return`.)

 I modified the error messages so they don't raise errors.

 > I thought we would advise the user (at the end, if any scripts were
 created) to add `directory` to his/her `PATH` in case it isn't already
 there.

 Done, although it will not print anything if `directory` is one of the
 directories added to PATH by sage-env.

 > As an overkill ...

 I didn't do this.

 One other change: in the old patch, in every iteration of the loop, we
 computed PATH and imported `have_program`; now this is just done once at
 the top.  (The "delta2to3" patch doesn't contain the relocation of the
 import command, but it's in the final v3 patch.)

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11602#comment:24>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to