Ubuntu 12.04: apt-get can't parse repository url if username contains @ ('at' sign)

Asked by Marcin Barczyński

I added a repository URL that contains to '@' (at sign) to /etc/apt/sources.list.d/myrepo.list:

deb https://FOO@BAR:<email address hidden>/xyz precise non-free

After that, apt-get update fails with: Couldn't resolve host 'BAR'

I tried to escape '@' using %40, and \ (backslash), but to no effect: the error message is the same. Apt version:
$ apt-get --version
apt 0.8.16~exp12ubuntu10.26 for amd64 compiled on Aug 5 2015 19:06:57

Is there a way to add the repository on Ubuntu 12.04? The URL is parsed correctly on Ubuntu 14.04.

[edit] Fixed displayed error message.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu apt Edit question
Assignee:
No assignee Edit question
Solved by:
Marcin Barczyński
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

What is the output of:

lsb_release -a; uname -a; cat -n /etc/apt/sources.list.d/myrepo.list

Thanks

Revision history for this message
Marcin Barczyński (marcinb) said :
#2

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.5 LTS
Release: 12.04
Codename: precise
$ uname -a
Linux localhost 3.13.0-32-generic #57~precise1-Ubuntu SMP Tue Jul 15 03:51:20 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ cat -n /etc/apt/sources.list.d/myrepo.list
     1 deb https://FOO@BAR:<email address hidden>/xyz precise non-free
$ apt-get --update
...
W: Failed to fetch https://domain.com/xyz/dists/precise/non-free/binary-amd64/Packages Couldn't resolve host 'BAR'

W: Failed to fetch https://domain.com/xyz/dists/precise/non-free/binary-i386/Packages Couldn't resolve host 'BAR'

E: Some index files failed to download. They have been ignored, or old ones used instead.

For security reasons, I prefer not to disclose the URL. But if I use a username without '@' (at sign) everything works fine.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

What if you change the line to:

deb https://domain.com/xyz precise non-free

Is it OK?

Revision history for this message
Manfred Hampl (m-hampl) said :
#4

According to the documentation replacing the @ sign by %40 should make it work, but you write that it doesn't.

If you change to

 deb https://FOO%40BAR:<email address hidden>/xyz precise

do you get the identical error message, or something different?

Revision history for this message
Marcin Barczyński (marcinb) said :
#5

Exactly the same problem with %40:

$ cat -n /etc/apt/sources.list.d/myrepo.list
     1 deb https://FOO%40BAR:<email address hidden>/xyz precise non-free
$ apt-get update
...
W: Failed to fetch https://domain.com/xyz/dists/precise/non-free/binary-amd64/Packages Couldn't resolve host 'BAR'

W: Failed to fetch https://domain.com/xyz/dists/precise/non-free/binary-i386/Packages Couldn't resolve host 'BAR'

E: Some index files failed to download. They have been ignored, or old ones used instead.

If the username doesn't contain '@', everything works fine. Even for this fake URI, there is a different error message:

$ cat -n /etc/apt/sources.list.d/myrepo.list
     1 deb https://FOOBAR:<email address hidden>/xyz precise non-free
$ apt-get update
...
Err https://domain.com precise/non-free amd64 Packages

Err https://domain.com precise/non-free i386 Packages

Ign https://domain.com precise/non-free Translation-en
W: Failed to fetch https://domain.com/xyz/dists/precise/non-free/binary-amd64/Packages

W: Failed to fetch https://domain.com/xyz/dists/precise/non-free/binary-i386/Packages

E: Some index files failed to download. They have been ignored, or old ones used instead.

Also, there is no problem on Ubuntu 14.04.

Revision history for this message
Manfred Hampl (m-hampl) said :
#6

I understand that you do not want to reveal the real usernames and domain names (and of course the password).

But due to editing that information, it is not clear to me whether the error message with @ sign is the same as the one that you get for %40 or not.

Is it
Couldn't resolve host 'BAR:<email address hidden>'
or
Couldn't resolve host 'BAR'
?

Revision history for this message
Marcin Barczyński (marcinb) said :
#7

That's interesting. The error message depends on the password:

deb https://FOO@BAR:<email address hidden>/xyz precise non-free --> Couldn't resolve host 'BAR:<email address hidden>'
deb https://FOO@BAR:<email address hidden>/xyz precise non-free --> Couldn't resolve host 'BAR'

Revision history for this message
Marcin Barczyński (marcinb) said :
#8

The error message depends on the first character of the password: a digit or a letter.

Revision history for this message
Marcin Barczyński (marcinb) said :
#9

deb https://FOO%40BAR:<email address hidden>/xyz precise non-free --> Couldn't resolve host 'BAR:<email address hidden>'
deb https://FOO%40BAR:<email address hidden>/xyz precise non-free --> Couldn't resolve host 'BAR'

Revision history for this message
Manfred Hampl (m-hampl) said :
#10

I searched through the change history of apt, but did not find any reference to such problem between the versions for precise and trusty. (Logic regarding escaping like %40 was there already before 0.8.16~exp12).

I suggest you create a bug report.

Revision history for this message
Marcin Barczyński (marcinb) said :
#11