Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 74615 - dispatch-conf cannot handle conf filenames with spaces
Summary: dispatch-conf cannot handle conf filenames with spaces
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on: 93874
Blocks: 194041
  Show dependency tree
 
Reported: 2004-12-16 04:17 UTC by Denis Knauf
Modified: 2007-09-28 00:15 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
quote all file paths inside dispatch-conf shell commands (dispatch-conf.patch,2.89 KB, patch)
2007-09-24 22:25 UTC, Zac Medico
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Denis Knauf 2004-12-16 04:17:19 UTC
all filenames must be quote, to handle filenames with spaces.
Comment 1 Nicholas Jones (RETIRED) gentoo-dev 2005-01-10 18:13:04 UTC
dispatch-conf is not written in bash
Comment 2 Alec Warner (RETIRED) archtester gentoo-dev Security 2005-05-24 18:51:28 UTC
kyoto etc # touch "bob .conf"
kyoto etc # touch "/etc/._cfg0000_bob .conf"
kyoto etc # dispatch-conf
diff: extra operand `/etc/._cfg0000_bob'
diff: Try `diff --help' for more information.

>> (1 of 1) -- /etc/bob .conf
>> q quit, h help, n next, e edit-new, z zap-new, u use-new
   m merge, t toggle-merge, l look-merge: diff: extra operand `/etc/.
_mrg0000_bob'
diff: Try `diff --help' for more information.

>> (1 of 1) -- /etc/bob .conf
>> q quit, h help, n next, e edit-new, z zap-new, u use-new
   m merge, t toggle-merge, l look-merge:

Language shouldn't matter, just file-name processing seems to be invalid when 
files have spaces.
Comment 3 Paul Bredbury 2005-11-18 19:18:03 UTC
In line 23 of /usr/bin/dispatch.conf, it should be:

DIFF_CONTENTS        = 'diff -Nu "%s" "%s"'

And in line 22 of /usr/lib/portage/pym/dispatch_conf.py, it should be:

DIFF3_MERGE = 'diff3 -mE "%s" "%s" "%s" >"%s"'

Even better would be a filename wrapper function to replace %s, which encloses
the filename in double quotes, and backlashes ("\") the following suspicious
filename characters:  \"`!?$
Comment 4 dan zwell 2007-09-23 17:50:52 UTC
I think it is more appropriate to add the quotes to the relevant lines in dispatch-conf.conf (and not do auto-addition of quotes), because when one of the variables that uses '%s' is extremely complex, a double quote may not be appropriate. For example, in my MERGE variable, I have a statement that calls emacs and runs ediff. It needs double escaped quotes (\\"%s\\"), so I put these in the variable. It would be bad to prevent users from being able to do this.
Comment 5 Zac Medico gentoo-dev 2007-09-24 22:25:54 UTC
Created attachment 131811 [details, diff]
quote all file paths inside dispatch-conf shell commands

(In reply to comment #4)
> I think it is more appropriate to add the quotes to the relevant lines in
> dispatch-conf.conf (and not do auto-addition of quotes)

Yes, that's what this patch does (some of the relevant lines are hard coded rather than in the config file). This is in svn r7803.
Comment 6 Zac Medico gentoo-dev 2007-09-28 00:15:28 UTC
This has been released in 2.1.3.10.