﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	difficulty
1012	getopt-long discards doublequotes and option values after whitespace characters	evhan	Ivan Raikov	"getopt-long contains logic for handling doublequote-wrapped option values. However, this interferes with option values containing internal doublequotes and makes it impossible to pass arguments that explicitly include surrounding doublequotes. I believe argument quoting is adequately resolved by the shell before option values are ever in CHICKEN's control (i.e. in the command-line-arguments parameter), so this logic is unnecessary and the attached patch removes it.

getopt-long also discards any characters in option values after and including the first whitespace character (that is, those in srfi-14's char-set:blank). This makes it impossible to pass arguments containing spaces without intentionally double-quoting them (to activate the doublequote-handling logic, which I believe is incorrect as noted above).

Finally, getopt-long accepts only a small set of characters in option values, raising an error on any characters not in that set. I believe this is an unnecessary restriction, so the patch removes it as well.

{{{
;;
;; Given the following (and assuming a common shell):
;;

(pp (command-line-arguments))
(pp (getopt-long (command-line-arguments) '((foo (value #t)))))

;;
;; $ ./test --foo=""\""bar\""""
;; (""--foo=\""bar\"""")
;; ((@) (foo . ""bar""))
;;
;; $ ./test --foo=""bar baz qux""
;; (""--foo=bar baz qux"")
;; ((@) (foo . ""bar""))
;;
;; $ ./test --foo=""\""bar baz qux\""""
;; (""--foo=\""bar baz qux\"""")
;; ((@) (foo . ""bar baz qux""))
;;
;; $ ./test --foo=""\""bar baz\"" qux""                                                                                 
;; (""--foo=\""bar baz\"" qux"")
;; ((@) (foo . ""bar baz""))
;;
;; $ ./test --foo='bar""baz""qux'
;; (""--foo=bar\""baz\""qux"")
;; ((@) (foo . ""barbazqux""))
;;
;; $ ./test --foo='bar+baz=qux'
;; (""--foo=bar+baz=qux"")
;; Error: (long-option-value) invalid option character: #\+
;;
}}}"	defect	closed	minor	someday	extensions	4.8.x	fixed	getopt-long		
