PDA

View Full Version : [all variants] Adding repository, with white spaces in URI



radiobert
February 8th, 2012, 12:47 PM
My repository URI has whitespaces in it, e.g. "file:/media/my documents/software dev/debs". How should I add it as an entry in sources.list file?

I tried following but it doesn't work:

deb 'file:/media/my documents/software' lucid main The 'apt-get update' simply outputs strange errors when the APT line above is used.

Seems like a bug to me anyway......;)

kc1di
February 8th, 2012, 12:56 PM
My repository URI has whitespaces in it, e.g. "file:/media/my documents/software dev/debs". How should I add it as an entry in sources.list file?

I tried following but it doesn't work:

deb 'file:/media/my documents/software' lucid main The 'apt-get update' simply outputs strange errors when the APT line above is used.

Seems like a bug to me anyway......;)

I haven't tried it yet but think it will work
try placing an * in the space and try again
so your entry would look like this

deb 'file:/media/my*documents/software' lucid main

drmrgd
February 8th, 2012, 01:37 PM
You might try to use an escape character for the space like this:


deb 'file:/media/my\ documents/software' lucid main]

For some things - like fstab if I'm not mistaken - you need the ocatal character escape for the space character. If the above doesn't work, you could try this to see if it works:


deb 'file:/media/my\040documents/software' lucid main

Lars Noodén
February 8th, 2012, 01:53 PM
Space is 20 in hexadecimal. So, for URI's the space should be escaped (http://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_in_a_URI) as %20. If you need to escape a lot of strings then you might turn to CPAN's URI::Escape (http://search.cpan.org/dist/URI/URI/Escape.pm) module or a corresponding module in the scripting language of your choice.



deb 'file:/media/my%20documents/software' lucid main

drmrgd
February 8th, 2012, 02:03 PM
Space is 20 in hexadecimal. So, for URI's the space should be escaped (http://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_in_a_URI) as %20. If you need to escape a lot of strings then you might turn to CPAN's URI::Escape (http://search.cpan.org/dist/URI/URI/Escape.pm) module or a corresponding module in the scripting language of your choice.



deb 'file:/media/my%20documents/software' lucid main


Thanks Lars! I never know what type of escape to use under different circumstances (i.e. '\ ' vs. '\040' vs '%20'). That Wikipedia page is quite informative!

kc1di
February 8th, 2012, 05:12 PM
Thanks Lars,
Good info :)

radiobert
February 9th, 2012, 01:58 PM
Thanks all, the "%20" escape character works! Now I don't need the single quotes at all, which doesn't work...