Emerge outputs the following (^H backspace?) non-standard text: These are the packages that would be merged, in order: Calculating dependencies ... . ..^H^H... done! [ebuild U ] media-video/mjpegtools-1.9.0 [1.8.0-r1] * IMPORTANT: 1 news items need reading for repository 'gentoo'. * Use eselect news to read news items. This problem is incurred if a user sends the output of emerge to a text file. (More notably, sending it to nail - a mail command - will cause the text file to be appended to an email as binary content instead of inline text.) Reproducible: Always Steps to Reproduce: 1. emerge -uDNpv --color -n world > test.txt 2. vi test.txt A quick hack is to use the following pipe: emerge -uDNp --color n world | tr -d '\010' | mail -s "Portage Update" root Or, just in case we come across any other non-text characters (for kicks): emerge -uDNp --color n world | tr -d '\015\032\010' | mail -s "Portage Update" root (For the past months, I'm also seeing a lot of other /etc/cron.* scripts - using other programs - creating mails with these special characters.)
=sys-apps/portage-2.2_rc33
% echo -n ^H | od -c 0000000 \b (^H = ctrl-v ctrl-h) I think it's the spinner, I have the same and it's like this for a long while. Never bothered me though ;)
I'm filtering the ^H with tr when attaching emerge outputs to emails. nail (/usr/bin/nail for /usr/bin/mail) is such a pain in the butt. Any non-standard character and it wines & bundles the attached text to an email as binary! Can close if this is standard output. Thought I was catching something here.
look: line 11550 and 11551 of pym/_emerge/__init__.py read: if show_spinner: print "\b\b... done!" I think the spinner should be disabled like colours are if the output is not a tty. Maybe something like this: Index: pym/_emerge/__init__.py =================================================================== --- pym/_emerge/__init__.py (revision 13625) +++ pym/_emerge/__init__.py (working copy) @@ -11527,7 +11527,8 @@ "would be merged, in order:\n\n")) show_spinner = "--quiet" not in self.myopts and \ - "--nodeps" not in self.myopts + "--nodeps" not in self.myopts and \ + sys.stdout.isatty() if show_spinner: print "Calculating dependencies ",
This would make sense. If the output is a pipe (ie. "emerge -u world > blah.log" or "emerge -u world |tee blah.log" or "emerge -u world |mail ..."), then turn-off spinner for output. Or, just add a switch "--no-spinner" and would be useful for the above situations?
$ tail -n +2914 pym/_emerge/actions.py | head -n 3 if '--nospinner' in emerge_config.opts or \ emerge_config.target_config.settings.get('TERM') == 'dumb' or \ not sys.stdout.isatty():