Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 24673 - einfo swallows escape characters
Summary: einfo swallows escape characters
Status: RESOLVED INVALID
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Unclassified (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-17 08:09 UTC by Peter Lietz
Modified: 2011-10-30 22:18 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Lietz 2003-07-17 08:09:23 UTC
This is really not a big deal, it may however indicate some more serious
problem? I don't know.

In an ebuild, in order to output a \ (backslash), one has to issue the command
einfo "\\". OK. One would expect that in order to output \\ one would have to
issue einfo "\\\\". The latter, however, prints a single \. In fact, einfo
"\\\\\\" and einfo "\\\\\\\\" produce double backslashes.

Reproducible: Always
Steps to Reproduce:
1. have the line einfo "\\\\" in an ebuild.
2. emerge that ebuild


Actual Results:  
The output is \.

Expected Results:  
The output is \\.

just out of interest, I did not find the code for einfo. Where is it?
Comment 1 SpanKY gentoo-dev 2003-07-17 15:11:06 UTC
it is defined in /sbin/functions.sh and then ebuild.sh sources it early on 
 
einfo "\\ \\" works fine ... you get '\ \' ... 
 
einfo uses 'echo -e "blah"' ... 
if you do `echo -e "\\\\"` at a cmd prompt you get the 'bug' ... 
in other words i dont think its something we can change :/ 
Comment 2 Peter Lietz 2003-07-17 15:53:22 UTC
I see. So echo really acts in an unexpected way (for me, that is). I agree that protage should not be changed but echo should (which, of course, is outside of gentoo's realm). The echo manpage says "\\     backslash", which should imply "\\\\    backslashbackslash".

I really need to output \\ as opposed to \ \, as it is part of a line one must add to .emacs exactly as is. The persistent workaround is einfo "\x5c\x5c", by the way.
Comment 3 Peter Lietz 2003-07-19 03:21:45 UTC
OK, the behaviour of both einfo and echo is completely normal, sorry for my confusion.

By typing echo -e "something", something gets evaluated by the shell first, and the result gets evaluated by echo. So echo -e "\\\\" has the same effect as echo -e '\\' which would be to output \. The same goes for einfo. If one does not want to have the argument of einfo being processed by bash, one can simply use single quotes.
Comment 4 Heinrich Wendel (RETIRED) gentoo-dev 2003-08-23 16:15:04 UTC
so this can be closed