bugThe GNU Hurd - Bugs: bug #15806, hello translator: unquoted...

 
 

bug #15806: hello translator: unquoted contents option

Submitter:  Ben Asselstine <benasselstine>
Submitted:  Sun 19 Feb 2006 08:27:51 PM UTC
   
 
Category:  Hurd Servers Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Privacy:  Public
Assigned to:  None Originator Name:  Ben Asselstine
Open/Closed:  Closed Reproducibility:  Every Time
Size (loc):  None Planned Release:  None
Effort:  0.00
Wiki-like text discussion box: 


* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 12 Sep 2016 10:55:56 PM UTC, comment #4: 

I prototyped changing fsysopts and showtrans to add quotation marks and backslashes to the argz vectors when printing them, so that POSIX sh can parse them.  I added a function that writes an argz vector to a FILE *, with heuristics so that --option=value becomes --option="value" rather than "--option=value" if possible.  It mostly works, but there are two snags:

(1) A malicious translator might return an invalid argz vector (in which the last string does not end with '\0') from file_get_translator or file_get_fs_options.  The argz_next function that I used is not documented as tolerating that.  Should use memchr instead, or just check the validity of the argz vectors as soon as they come from the RPCs.

(2) The upstream version of fsysopts passes the result of argz_stringify to the error function if fsys_set_options fails.  It is not straightforward to replace that argz_stringify call with a function that writes to a FILE *.  Should either use open_memstream or replace the quoting function with one that writes to a character buffer.

The idea of having fsysopts and showtrans quote the strings seems reasonable overall, though.

It is probably not useful to add a -0 option like in xargs.

Kalle Olavi Niemitalo <kon>
Wed 07 Sep 2016 08:39:18 PM UTC, comment #3: 

I believe this was not a bug, and the fix should be reverted.

In hurd/fsys.defs, the comment above fsys_get_options says the result should be "sutiable for fsys_set_options". The hello and hello-mt translators do not parse quotation marks in parse_opt nor in libtrivfs, so they should not add any quotation marks in trivfs_append_args.

Instead, utils/fsysopts.c could add quotation marks and backslashes when it displays the options.  Currently, it uses argz_stringify, which doesn't do that.

Kalle Olavi Niemitalo <kon>
Thu 04 Sep 2014 11:32:45 PM UTC, comment #2: 

Fixed in 74fc3df9e4ecd84b971904d3e14e5a710d941836.

Justus Winter <teythoon>
Group Member
Sun 19 Feb 2006 11:38:48 PM UTC, comment #1: 

How's this fix?

2006-02-19  Ben Asselstine  <benasselstine@gmail.com>
        * hello.c (escapestr): New static function.
          (trivfs_append_args): quoting and escaping --contents
          parameter.

I'm escaping $, \ and ".  Is this enough?

See attached patch.

Ben Asselstine <benasselstine>
Sun 19 Feb 2006 08:27:51 PM UTC, original submission:  

Hello,

In trans/hello.c:trivfs_append_args, the parameter to the "contents" command-line option is not quoted.

Here's an illustrative example:

$ settrans -ac yoyo /hurd/hello --contents="hello hurd

> "

$ cat yoyo
hello hurd
$ fsysopts yoyo
/hurd/hello --contents=hello hurd

$ settrans -g yoyo

regards,

Ben

Ben Asselstine <benasselstine>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #41508:  0001-fsysopts-showtrans-Quote-argz-for-sh-when-printing.patch added by kon (16KiB - text/x-patch - Recognizing invalid multibyte sequences and control characters makes this complex.)
file #1902:  hello.diff added by benasselstine (1KiB - text/x-patch - patch to quote and escape the --contents command-line parameter in the hello translator)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by kon (Posted a comment)
  • -email is unavailable- added by teythoon (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-08-13 kon Attached File- Added 0001-fsysopts-showtrans-Quote-argz-for-sh-when-printing.patch, #41508
    2014-09-04 teythoon StatusNone Fixed
        Open/ClosedOpen Closed
    2006-02-19 benasselstine Attached File- Added hello.diff, #3422
    2006-02-19 benasselstine Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code