[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to correctly pass filename to dchroot

On Tuesday 03 January 2006 13:46, Koen Vermeer wrote:
> I'd like to be able to simply click a file on my Gnome desktop. It's
> easy to tell Gnome to run 'dchroot -d oowriter', but I cannot tell it
> how to pass the filename. The problem is that, if I have a file with
> name 'test test.doc', I can open it by running 'dchroot -d oowriter
> "test\ test.doc'. The following methods don't work:
> dchroot -d oowriter test test.doc
> dchroot -d oowriter test\ test.doc
> dchroot -d oowriter "test test.doc"
> I expect that I'm not the only one with this problem, so how did others
> solve it? Or should I be asking aroung on a Gnome list?

I could never get dchroot to handle every possible valid filename directly. 
Even doing tricks to make things work with spaces would fail if I had a 
file with single-quotes, for instance. 

Anyway, I ended up using a pair of scripts so that I can handle ANY possible 
filename, including ones with mixes of single and double-quotes, spaces, or 
other shell metacharacters. They are attached in case they're useful. (The 
first one (not the .helper) is the one that is linked to the program name 
that should be run in the chroot.)

Wesley J. Landaker <wjl@icecavern.net> <xmpp:wjl@icecavern.net>
OpenPGP FP: 4135 2A3B 4726 ACC5 9094  0097 F0A9 8A4C 4CD6 E3D2

Attachment: run_in_chroot_unstable-i386
Description: application/shellscript

cmdfile, program, args = ARGV

def shellquote(x)

File.open(cmdfile,"w") { |file|
  unless args.nil?
    args.each { |arg|
      file.print(" ")

Attachment: pgpoBynsk3Q0F.pgp
Description: PGP signature

Reply to: