Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 15387 - Fix colorgcc arg handling, new PATH handling, ebuild.sh support
Summary: Fix colorgcc arg handling, new PATH handling, ebuild.sh support
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Please assign to toolchain
URL:
Whiteboard:
Keywords:
Depends on: 29178
Blocks: 2679 20356
  Show dependency tree
 
Reported: 2003-02-09 16:29 UTC by Wayne Davison
Modified: 2007-02-28 11:33 UTC (History)
5 users (show)

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


Attachments
The improved colorgcc ebuild. (colorgcc-1.3.2-r3.tar.bz2,2.06 KB, application/octet-stream)
2003-02-09 16:31 UTC, Wayne Davison
Details
Updated colorgcc ebuild. (colorgcc-1.3.2-r4.tar.bz2,2.36 KB, application/x-bzip2)
2003-02-11 05:42 UTC, Wayne Davison
Details
My latest colorgcc ebuild. (colorgcc-1.3.2-r5.tar.bz2,2.27 KB, application/x-bzip2)
2003-02-12 21:07 UTC, Wayne Davison
Details
New colorgcc ebuild. (colorgcc-1.3.2-r6.tar.bz2,2.19 KB, application/x-bzip2)
2003-02-23 04:30 UTC, Wayne Davison
Details
Latest colorgcc ebuild. (colorgcc-1.3.2-r7.tar.bz2,2.59 KB, application/x-bzip2)
2003-03-30 19:30 UTC, Wayne Davison
Details
Another new colorgcc ebuild. (colorgcc-1.3.2-r8.tar.bz2,2.93 KB, application/x-bzip2)
2003-04-07 20:34 UTC, Wayne Davison
Details
More colorgcc improvements (colorgcc-1.3.2-r9.tar.bz2,3.71 KB, application/x-bzip2)
2003-04-11 20:02 UTC, Wayne Davison
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wayne Davison 2003-02-09 16:29:23 UTC
With the work going into updating distcc and ccache, I decided to also update
colorgcc.  This new ebuild improves things in several ways:

Changed where colorgcc's wrapper symlinks are installed to be
/usr/lib/colorgcc/bin (to be consistent with the new distcc and ccache) installs
and extended the set of symlinks to include the missing CHOST versions of gcc.

Superseded the *gcc_config.patch with a *wrapper.patch that implements the
PATH-prefix-stripping idiom that I designed for distcc's ebuild.  This makes the
script automatically work wherever it is put into the PATH without the user
needing to tell it what to execute next (though colorgcc supports a means of
overriding this).

This ebuild will make it easy to add colorgcc support to ebuild.sh (I'll comment
about that on bug 2679, which is requesting that feature).

Reproducible: Always
Steps to Reproduce:
Comment 1 Wayne Davison 2003-02-09 16:31:56 UTC
Created attachment 8097 [details]
The improved colorgcc ebuild.

If you just want to try this out, un-tar this into /usr/local/portage/dev-util
(if you have the local portage support configured in make.conf) and "emerge
colorgcc".
Comment 2 Wayne Davison 2003-02-11 05:42:06 UTC
Created attachment 8157 [details]
Updated colorgcc ebuild.

Tweaked the sample colorgccrc file to comment-out the setting of the compiler
values (since the script works out who to call on its own now).
Comment 3 Wayne Davison 2003-02-12 21:01:28 UTC
I was looking at the colorgcc build in more detail, and I discovered that
the debian patches are broken.  The original 1.3.2 release uses the non-shell
version of exec (so no shell meta characters need to be escaped), but the
debian patches change this to use the a single string with explicit call to
a shell (which results in two shells being spawned), but more importantly,
not enough meta-char handling is being done to ensure that the args are
processed correctly.  For instance, this weird command:

colorgcc "'foo>bar'"

results in a shell syntax error and the file 'bar"' being created in the
current directory.  The fix is to go back to the original, non-shell using
exec syntax of release 1.3.2.  In my fixed version, the output is as it
should be:

gcc: 'foo>bar': No such file or directory

I even went back to the original debian bug report and tried to duplicate
what was in the bug.  My only guess as to why the debian bug-reporter was
seeing a failure was that open3() was not doing a proper exec @array call
in 1999.  This does not appear to be the case in a modern perl.

Also of note, the tar file from the debian web site has several files that
have DOS line-endings.  They even include a patch that does nothing but
replace all the lines in the colorgccrc file with identical lines that end
in just a newline.  I went back to the real home site for colorgcc, and the
1.3.2 tar file from there does not have this problem, so it is a better
source file to start from.
Comment 4 Wayne Davison 2003-02-12 21:07:38 UTC
Created attachment 8212 [details]
My latest colorgcc ebuild.

Here's a new ebuild that fixes the above exec bug, and includes all my
previous enhancments plus one extra:

I noticed that an ebuild that tries to use colorgcc fails to get color
because the output is not going to a tty.  I decided to add an environment
variable that will allow the tty check to be turned off.  I think that
having this signaled in the environment is the right way to go because we
only sometimes want this checking to be disabled, and we thus need a better
way to temporarily tweak the setting than putting it into the colorgcc
config file.
Comment 5 Martin Schlemmer (RETIRED) gentoo-dev 2003-02-22 07:29:15 UTC
What about skipping color check if [ -n "$EBUILD" ] ?
Comment 6 Wayne Davison 2003-02-22 13:14:15 UTC
I've actually decided that the tty-check-skipping part of my patch is a bad
idea.  It interferes with the ability for configure to interpret the output
of the compiler, so it messes things up.  I think a better solution is going
to be to have colorgcc tweak the output of the ebuild command.  I'm currently
trying out a change that takes this route and will update my colorgcc ebuild
when I get it done.
Comment 7 Wayne Davison 2003-02-23 04:30:13 UTC
Created attachment 8619 [details]
New colorgcc ebuild.

This ebuild omits the part of my last patch that allowed the user to skip the
tty checking (since that was a bad idea).  What is new is adding a wrapper
symlink for ebuild.sh (that is hard-configured to forward the command on to
/usr/sbin/ebuild.sh).  This will allow a change to the portage.py library to
have it optionally call the ebuild.sh wrapper, and thus get its gcc output
colored.  (I'll comment on bug 2679 when I have that finished.)

I also tweaked the regex in colorgcc slightly so that it wouldn't match non-
error/warning lines that ebuild.sh can output.	(This change should not affect
the normal coloring of gcc/g++/etc.)

To sum up, this ebuild improves upon the current colorgcc ebuild in the
following ways:

1. It figures out for itself what program to call next (allowing the
   wrappers to be put into the PATH prior to distcc, ccache, or whatever
   else without having to tweak the config file).
2. It fixes the exec code to avoid any problems with shell meta characters
   (by avoiding the broken patch in the Debian version).
3. It uses a better starting tar so that files don't have DOS line endings.
4. It puts the wrapper symlinks into /usr/lib/colorgcc/bin (which make it
   consistent with the new distcc and my proposed change to ccache).
Comment 8 Wayne Davison 2003-03-30 19:30:39 UTC
Created attachment 10049 [details]
Latest colorgcc ebuild.

This version of the ebuild has been updated to depend on the right perl
category (which is dev-lang/perl these days) and to make two more minor
tweaks to the coloration patterns.
Comment 9 Nicholas Wourms 2003-04-07 14:14:05 UTC
Is there any reason why this shouldn't be checked in?  I, too, use colorgcc and I'd 
welcome its integration into portage.  Since #2679 depends on this ebuild, I'd like to 
see this go in. 
Comment 10 Wayne Davison 2003-04-07 17:51:08 UTC
One thing I thought of recently that the ebuild doesn't yet do:

We should output a warning that tells users that they should modify any
existing .colorgccrc files to remove hard-coded compiler paths (since the
script now figures out who to call on its own).  We should probably also
mention to the user that the "masquerade dir" (where the symlinks are
placed) has changed.
Comment 11 Wayne Davison 2003-04-07 20:34:48 UTC
Created attachment 10354 [details]
Another new colorgcc ebuild.

Here's my latest version of this ebuild.  Since Nicholas doesn't like the
idea of having an ebuild.sh symlink in the colorgcc masquerade dir, I've
removed that from the ebuild.  I also added in some einfo output that tells
users about the changes that happened that they should be aware of.  Other
changes:

 - We now install an /etc/colorgcc/colorgccrc file for global configuration
   and the support for this file has been restored to the ebuild (I had
   removed it for a while, but I think we should leave it as it was).

 - The INSTALL file now mentions the above colorgccrc file and no longer
   suggests configuring absolute compiler paths (which the user should
   not do anymore).
Comment 12 Martin Schlemmer (RETIRED) gentoo-dev 2003-04-08 14:59:25 UTC
No reason but that I fixed it before, as nobody else wanted to.  Talk to zwelch,
if it fits with ccache/distcc, commit it if tests ok (not like the way you tested
debianutils though :P).
Comment 13 Wayne Davison 2003-04-11 20:02:05 UTC
Created attachment 10529 [details]
More colorgcc improvements

I've added a few more improvements to the colorgcc script:

- Revised the rc-file parsing so that it doesn't have any hard-wired
  compiler names in the code (Debian has patches that extend the name
  matching, but this slight restructure is better, and won't ever need
  to be changed again to support different compiler names).
- Added a filter mode when called as "colorgcc" (rather than as one of
  our masquerade symlinks).  This allows someone to pipe output through
  colorgcc rather than having colorgcc exec a program (if desired).  For
  instance, this might be used in ebuild.sh to color the data going into
  a portage log file (if Nick likes the idea).
- Upgraded the script to "use strict" compliance.
- Made my new code's style more closely match the style of the existing
  script (the "When in Rome..." rule of programming).
Comment 14 SpanKY gentoo-dev 2003-09-19 03:02:43 UTC
------- Additional Comments From kumba@gentoo.org  2003-18-09 12:35 EST -------
Gave this ebuild a test run on my x86 box.  Seems basic gcc output is still white via portage, but haven't seen any warnings yet in the few packages I compiled.  Must still need the changes in Bug #20356.  However, with the ebuild working, anyone got any qualms if I commit this as -r4 of colorgcc (the ebuild is labelled -r9)?
Comment 15 SpanKY gentoo-dev 2003-09-19 03:27:36 UTC
------- Additional Comments From gentoo@blorf.net  2003-18-09 13:38 EST -------
Joshua: To see colored ebuild output after installing this ebuild you still need 
to apply the ebuild.sh patch from bug 2679, and to add "colorgcc" to your 
FEATURES.  Note that bug 20356 should probably be closed as a duplicate of bug 
2679, especially since its secondary request to update the Debian patches isn't 
needed once this ebuild gets committed.
Comment 16 Martin Holzer (RETIRED) gentoo-dev 2003-09-25 12:54:28 UTC
it's not needed but i wan't that devs doesn't forget this bug
Comment 17 Joshua Kinard gentoo-dev 2003-10-02 10:08:45 UTC
Resolving as FIXED.  dev-util/colorgcc-1.3.2-r4 is in portage with the patch
from this bug and the patch included on Bug #29178.  If the Portage people
don't mind, this clears the way for Bug #2679 to finally be cleared (old
bug).