[virt-tools-list] Paths with whitespace in guestfish

Richard W.M. Jones rjones at redhat.com
Wed Nov 18 14:22:42 UTC 2015


[I don't check this list for libguestfs questions, hence the late
reply.  There's a libguestfs mailing list:
https://www.redhat.com/mailman/listinfo/libguestfs ]

On Mon, Oct 12, 2015 at 08:06:03PM -0500, Robert Nichols wrote:
> Is guestfish able to handle paths that include whitespace? I've
> tried just about everything I can think of:
> 
> ><fs> ls /Users/Owner/My\ Documents
> ls should have 1 parameter(s)
> type 'help ls' for help on ls
> ><fs> ls "/Users/Owner/My Documents"
> libguestfs: error: ls0: opendir: /Users/Owner/My Documents: No such
> file or directory

This syntax (single or double quoting) is the correct one and works
fine for me:

><fs> ls "/Program Files/Windows NT/Accessories"
mswrd6.wpc
mswrd8.wpc
wordpad.exe
write.wpc

I'm guessing it may be a case sensitivity problem.  You could try
prepending 'win:...' (a guestfish-specific hack for Windows) in front
of the path, as described in the manual:

http://libguestfs.org/guestfish.1.html#windows-paths

For example:

><fs> ls "/program files/windows nt/accessories"
libguestfs: error: ls0: opendir: /program files/windows nt/accessories: No such file or directory

><fs> ls "win:/program files/windows nt/accessories"
mswrd6.wpc
mswrd8.wpc
wordpad.exe
write.wpc

><fs> set-trace true
><fs> ls "win:/program files/windows nt/accessories"
libguestfs: trace: case_sensitive_path "/program files/windows nt/accessories"
libguestfs: trace: case_sensitive_path = "/Program Files/Windows NT/Accessories"
libguestfs: trace: ls "/Program Files/Windows NT/Accessories"
libguestfs: trace: ls0 "/Program Files/Windows NT/Accessories" "/tmp/libguestfse0H7nF/ls10"
libguestfs: trace: ls0 = 0
libguestfs: trace: ls = ["mswrd6.wpc", "mswrd8.wpc", "wordpad.exe", "write.wpc"]
mswrd6.wpc
mswrd8.wpc
wordpad.exe
write.wpc

(notice the extra call to case_sensitive_path in the trace).

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html




More information about the virt-tools-list mailing list