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

 
 

bug #15806: hello translator: unquoted contents option

Submitted by:  Ben Asselstine <benasselstine>
Submitted on:  Sun Feb 19 20:27:51 2006  
 
Category: Hurd ServersSeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: FixedPrivacy: Public
Assigned to: NoneOriginator Name: Ben Asselstine
Open/Closed: ClosedReproducibility: Every Time
Size (loc): NonePlanned Release: None
Effort: 0.00
Wiki-like text discussion box: 

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon Sep 12 22:55:56 2016, 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 Sep 7 20:39:18 2016, 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 Sep 4 23:32:45 2014, comment #2:

Fixed in 74fc3df9e4ecd84b971904d3e14e5a710d941836.

Justus Winter <teythoon>
Project Member
Sun Feb 19 23:38:48 2006, 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 Feb 19 20:27:51 2006, 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 File(s):
   
   
Comment:
   

Attached Files
file #1902:  hello.diff added by benasselstine (1kB - 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
  • -unavailable- added by kon (Posted a comment)
  • -unavailable- added by teythoon (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu Sep 4 23:32:45 2014teythoonStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Sun Feb 19 23:38:48 2006benasselstineAttached File-=>Added hello.diff, #3422
    Sun Feb 19 20:27:51 2006benasselstineCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup