Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrapper script for interpreted LablTk wrongly handles command line parameters #5475

Closed
vicuna opened this issue Jan 13, 2012 · 1 comment

Comments

Projects
None yet
2 participants
@vicuna
Copy link

commented Jan 13, 2012

Original bug ID: 5475
Reporter: nodakai
Assigned to: @lefessan
Status: closed (set by @xavierleroy on 2013-08-31T10:44:21Z)
Resolution: fixed
Priority: low
Severity: minor
Version: 3.13.0+dev
Fixed in version: 3.13.0+dev
Category: ~DO NOT USE (was: OCaml general)

Bug description

I found a problematic code in the wrapper shell script for interpreted LablTk.

$ cat which labltk
#!/bin/sh
exec /home/nodakai/ocaml/lib/ocaml/labltk/labltktop -I /home/nodakai/ocaml/lib/ocaml/labltk $*

Here, the last $* should be "$@" according to sh specification.
http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html

Currently it cannot accept an argument containing spaces.

Steps to reproduce

$ cat labltk_space.ml
let main argv =
let top = Tk.openTk () in
Wm.title_set top argv.(1);
Tk.mainLoop ()
;; main Sys.argv

$ labltk labltk_space.ml "10 20"
+---------+
[ 10 ]
+---------+
| |
| |
+---------+

Additional information

A natively compiled version doesn't suffer from the above problem

$ ocamlopt.opt -I +labltk labltk.cmxa labltk_space.ml -o labltk_space.exe
$ ./labltk_space.exe "10 20"
+---------+
[ 10 20 ]
+---------+
| |
| |
+---------+

This problem is also in trunk

http://caml.inria.fr/cgi-bin/viewvc.cgi/ocaml/trunk/otherlibs/labltk/lib/Makefile?revision=HEAD&view=markup

I attached a patch for trunk.

File attachments

@vicuna

This comment has been minimized.

Copy link
Author

commented Jan 17, 2012

Comment author: @lefessan

I applied the patch, tested it, and also modified myocamlbuild.ml that tries to generate the same file (commit r12032 in SVN trunk).

@vicuna vicuna closed this Aug 31, 2013

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.