Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 23116
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: John Mylchreest (RETIRED) <johnm@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Boris Tschirschwitz <boris@math.ubc.ca>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
tmp.txt fixheadtails text/plain John Mylchreest (RETIRED) 2003-08-11 01:42 0000 791 bytes Details
tmp.txt fixheadtails text/plain John Mylchreest (RETIRED) 2003-08-11 02:03 0000 322 bytes Details
tmp.txt list of offending files in gentoo-x86 (some can be safely ignored) text/plain John Mylchreest (RETIRED) 2003-08-11 02:23 0000 3.05 KB Details
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 23116 depends on: Show dependency tree
Bug 23116 blocks: 31801 31836 32623 33211 33571 33851 34015 34487 36156
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2003-06-19 09:58 0000
Many Makefiles use the coreutils 'head' and 'tail'.
In the new version they require that the option '-1' is replaced with '-n 1'.
This breaks lots of builds.

Reproducible: Always
Steps to Reproduce:
1.
2.
3.




I guess it would be nice to have something like a 'sed' line that replaces '-1'
with '-n 1' after 'head' and 'tail' as part of ebuilding a package.

------- Comment #1 From Seemant Kulleen (RETIRED) 2003-06-21 09:12:57 0000 -------
can you list some which are broken?

------- Comment #2 From Boris Tschirschwitz 2003-06-21 09:25:34 0000 -------
Broken builds: (I'll add as I come across them):
1. kde-base/kdeadmin-3.1.2

------- Comment #3 From Boris Tschirschwitz 2003-06-21 10:10:09 0000 -------
2. dev-util/arch-1.0_pre17

------- Comment #4 From Boris Tschirschwitz 2003-06-25 07:26:45 0000 -------
3. dev-lang/squeak-3.4.1
4. kernel 2.5.73-mm1: tail bails twice, but compile finishes and kernel works ;(

------- Comment #5 From Boris Tschirschwitz 2003-07-08 05:19:58 0000 -------
5. app-games/enemy-territory-2.55
6. dev-haskell/hmake-3.08

------- Comment #6 From Rafal Dejewski 2003-07-08 07:40:56 0000 -------
I've looked at coreutils info page - there are different posix standards for
many commands.  
Try setting:  
export _POSIX2_VERSION=199209  



------- Comment #7 From Boris Tschirschwitz 2003-07-08 08:33:04 0000 -------
Wow, that solves the problem, perhaps it should be set as default in coreutils
for now.

------- Comment #8 From John Mylchreest (RETIRED) 2003-07-15 07:23:13 0000 -------
just to note another one is blackdown-jdk which prevents mod_php and other
biggies.
doesnt seem to happen with gcc-2.x only gcc-3.x

------- Comment #9 From Martin Schlemmer (RETIRED) 2003-07-20 09:56:50 0000 -------
Seemant, what is the status on this (interest sake)?

------- Comment #10 From Seemant Kulleen (RETIRED) 2003-07-24 03:57:08 0000 -------
Az, as far as I know, John is working on patching the offending makefiles

------- Comment #11 From Eric Chu 2003-08-06 13:54:04 0000 -------
7. kde-base/arts-1.1.3

------- Comment #12 From John Mylchreest (RETIRED) 2003-08-11 01:42:45 0000 -------
Created an attachment (id=15882) [details]
fixheadtails

This is a quick bash script to replace all those evil occurances of head -X and
tail -X with newer POSIX compliant ones.
This should probably be in distfiles and ran from offending ebuilds, I am ok to
do this.

Anyone have any objections to this method of working?

------- Comment #13 From John Mylchreest (RETIRED) 2003-08-11 02:03:28 0000 -------
Created an attachment (id=15883) [details]
fixheadtails

------- Comment #14 From John Mylchreest (RETIRED) 2003-08-11 02:23:57 0000 -------
Created an attachment (id=15886) [details]
list of offending files in gentoo-x86 (some can be safely ignored)

------- Comment #15 From John Mylchreest (RETIRED) 2003-08-11 03:43:36 0000 -------
just to update you, I have written an eclass and am now testing it with other
ebuilds to see how we get on.
I suspect this should be in good working order sometime after work, when i get
chance to sit down properly with it.

------- Comment #16 From David Nielsen 2003-08-26 05:36:38 0000 -------
Let's just add Enemy Territory to the list of stuff that needs fixing. 

------- Comment #17 From SpanKY 2003-09-05 08:19:19 0000 -------
actually enemy-territory isnt broken, the unpack_makeself in eutils.eclass is
... i'll fix it shortly

------- Comment #18 From David Nielsen 2003-09-07 13:26:17 0000 -------
and let's add Arch as well...

------- Comment #19 From Adrian Almenar 2003-09-09 21:58:26 0000 -------
sun-jdk ebuilds appear in the list of files offending but theyre working ok, i 
have tested with coreutils-5.0-r1,r3. 
 
Any ideas on this ?? 

------- Comment #20 From John Mylchreest (RETIRED) 2003-09-17 14:36:03 0000 -------
fixheadtails is now in eclasses.
usage is explained within that although basic usage is:

inherit fixheadtails

src_unpack() {
unpack ${A}
cd ${S}
ht_fix_all
}

i have fixed hmake already, i have problems compiling squeak anyways so i will notify the relevant maintainers.
can people please update this bug with any other packages needing fixing, and i shall do so. i will work on those i am aware of now.

------- Comment #21 From Martin Schlemmer (RETIRED) 2003-09-17 15:16:51 0000 -------
You are going to miss calls like 'tail +16c foo'.  From the info pages:

----------------------------------------------------------------
   On older systems, `tail' supports an obsolete option
`-COUNTOPTIONS', which is recognized only if it is specified first.
COUNT is a decimal number optionally followed by a size letter (`b',
`k', `m') as in `-c', or `l' to mean count by lines, or other option
letters (`cfqv').  Some older `tail' implementations also support an
obsolete option `+COUNT' with the same meaning as `-+COUNT'.  POSIX
1003.1-2001 (*note Standards conformance::) does not allow these
options; use `-c COUNT' or `-n COUNT' instead.
----------------------------------------------------------------

That was for tail.  head is pretty much the same, except it only support
'cqv' and not 'cfqv'.

Here is my scripts (ok not optimal in speed ;), which do handle these
cases - hope it helps:

----------------------------------------------------------------
azarah@nosferatu glibc $ cat /usr/src/scripts/fix_head.sh
#!/bin/bash
 
fix_head_arg="$(readlink -f "$1" 2>/dev/null)"
 
source /sbin/functions.sh
 
x=
count=0
 
[ -z "${fix_head_arg}" ] && exit 1
[ ! -d "${fix_head_arg}" ] && exit 1
 
einfo "Scanning ${fix_head_arg} ..."
for x in $(find ${fix_head_arg}/ -type f -exec \
           grep -l -e 'head[[:space:]]\+-[0-9]' -- {} \;)
do
        [ "${count}" -eq 0 ] && eend 0
 
        x_relative="$(echo "${x}" | sed -e "s|^${fix_head_arg}||")"
        einfo " Fixing $(basename "${fix_head_arg}")${x_relative} ..."
        sed -i -e 's|head[[:space:]]\+-\([0-9]\+[bkm]\?\)\([cqv]\?*\)|head -\2 \1|g' \
               -e 's|head -\([^nc ]*\) \([+0-9]\+\)|head -n\1 \2|g' -- "${x}"
        eend $?
 
        [ "${count}" -eq 0 ] && x=1
done
 
[ "${count}" -eq 0 ] && eend 0
 
azarah@nosferatu glibc $ cat /usr/src/scripts/fix_tail.sh
#!/bin/bash
 
fix_tail_arg="$(readlink -f "$1" 2>/dev/null)"
 
source /sbin/functions.sh
 
x=
count=0
 
[ -z "${fix_tail_arg}" ] && exit 1
[ ! -d "${fix_tail_arg}" ] && exit 1
 
einfo "Scanning ${fix_tail_arg} ..."
for x in $(find ${fix_tail_arg}/ -type f -exec \
           grep -l -e 'tail[[:space:]]\+[-+][0-9]' -- {} \;)
do
        [ "${count}" -eq 0 ] && eend 0
 
        x_relative="$(echo "${x}" | sed -e "s|^${fix_tail_arg}||")"
        einfo " Fixing $(basename "${fix_tail_arg}")${x_relative} ..."
        sed -i -e 's|tail[[:space:]]\+\([-+][0-9]\+[bkm]\?\)\([cfqv]\?*\)|tail -\2 \1|g' \
               -e 's|tail -\([^nc ]*\) -\?\([+0-9]\+\)|tail -n\1 \2|g' -- "${x}"
        eend $?
 
        [ "${count}" -eq 0 ] && x=1
done
 
[ "${count}" -eq 0 ] && eend 0
 
azarah@nosferatu glibc $

------- Comment #22 From Martin Schlemmer (RETIRED) 2003-09-17 15:19:48 0000 -------
Ok, paste was not good, here is the 'sed' parts again:

----------------------------fix_head.sh-----------------------------
sed -i -e 's|head[[:space:]]\+-\([0-9]\+[bkm]\?\)\([cqv]\?*\)|head -\2 \1|g' \
       -e 's|head -\([^nc ]*\) \([+0-9]\+\)|head -n\1 \2|g' -- "${x}"
--------------------------------------------------------------------

----------------------------fix_tail.sh-----------------------------
sed -i -e 's|tail[[:space:]]\+\([-+][0-9]\+[bkm]\?\)\([cfqv]\?*\)|tail -\2 \1|g' \
       -e 's|tail -\([^nc ]*\) -\?\([+0-9]\+\)|tail -n\1 \2|g' -- "${x}"
--------------------------------------------------------------------


------- Comment #23 From David Nielsen 2003-09-26 15:25:35 0000 -------
add dev-utils/arch-1.0_pre17 to the list of broken stuff 

------- Comment #24 From Ahmed Farid 2003-09-26 21:10:50 0000 -------
add also app-text/ispell-3.2.06-r6 :)

------- Comment #25 From Ed Catmur 2003-10-25 17:26:52 0000 -------
Another offending Makefile is in the 2.4.20 kernel (sys-kernel/gentoo-sources).
It doesn't break the kernel itself but prevents it generating the compile.h
file correctly, which breaks other ebuilds (so far the alsa-driver ebuild):

@echo \#define LINUX_COMPILER \"`$(CC) $(CFLAGS) -v 2>&1 | tail -1`\" >>
.ver

(line 351)

------- Comment #26 From Ed Catmur 2003-10-25 17:31:03 0000 -------
*** Bug 31871 has been marked as a duplicate of this bug. ***

------- Comment #27 From John Mylchreest (RETIRED) 2003-10-28 10:55:22 0000 -------
this will also be expanded to handle sort/chown and other issues addressed
in future.
Working on a sort issue as we speak but i dont expect a commit until tomorrow.

------- Comment #28 From AlterEgo 2003-11-22 05:22:42 0000 -------
Changes in the chown user.group syntax cause errors in
/etc/cron.daily/syslog.cron:      
/bin/chown root:adm $LOG   does work correctly.
However, the default syntax is /bin/chown root.adm $LOG.


------- Comment #29 From Marius Mauch (RETIRED) 2003-11-22 07:43:03 0000 -------
*** Bug 32582 has been marked as a duplicate of this bug. ***

------- Comment #30 From Seemant Kulleen (RETIRED) 2003-11-22 12:39:56 0000 -------
actually, looks like avenj fixed sysklogd's cron.daily script a while ago, so a
remerge should sort you out.

------- Comment #31 From Don Seiler (RETIRED) 2003-11-26 07:05:03 0000 -------
media-sound/abcde emerges, but cddb/freedb lookups are broken until I set the
_POSIX2_VERSION as indicated earlier.

------- Comment #32 From Hermann Gundel 2003-11-27 07:27:03 0000 -------
There is also a problem on the alpha platform, where the (binary) compaq-jdk
uses "head -1" in its java wrapper. Setting _POSIX2_VERSION seemed to help.

------- Comment #33 From Martin Holzer (RETIRED) 2003-11-27 09:32:18 0000 -------
alpha-team see comment #32

------- Comment #34 From Andrea Cerrito 2003-12-03 03:30:32 0000 -------
Is it possible to fix this bug directly during compile of coureutils?
Not only ebuilds are broken, even installers (eg: install-crossover-office-2.0.1.sh).

------- Comment #35 From Decade 2003-12-22 16:50:32 0000 -------
kde_base/arts-1.1.2

Add to that a substantial amount of KDE. Newer versions with variations of the head fix are marked stable for almost every architecture. That doesn't help me when I'm running an Alpha.

------- Comment #36 From Aron Griffis (RETIRED) 2004-01-12 19:52:21 0000 -------
I fixed compaq-jre and compaq-jdk, and since I'm in the midst of working on
kde-3.1.4 for alpha-stable, Decade's comment should be moot soon. :-)

------- Comment #37 From Martin Holzer (RETIRED) 2004-01-12 23:16:59 0000 -------
this issue isn't resent in debian
maybe we could patch head and tail to accept the old syntax

------- Comment #38 From Martin Holzer (RETIRED) 2004-01-12 23:48:59 0000 -------
s/resent/represent

------- Comment #39 From Seemant Kulleen (RETIRED) 2004-01-12 23:57:10 0000 -------
5.0.91-r3 and -r4 are patched already, actually

------- Comment #40 From Martin Holzer (RETIRED) 2004-01-13 00:23:09 0000 -------
and how about the coreutils-5.0 ?
how about patching it too and remove all old ebuilds without patch

------- Comment #41 From Seemant Kulleen (RETIRED) 2004-01-13 00:38:46 0000 -------
No, I'm rather pushing 5.0.91 more than 5.0, as I stated recently on one of the
mailing lists, I'd like to get -r4 to stable in the next 2 or 3 weeks. At that
point, I'll remove 5.0 from the tree entirely

------- Comment #42 From Aron Griffis (RETIRED) 2004-01-15 07:20:41 0000 -------
coreutils-5.0.91-r4.ebuild is now marked stable on alpha and ia64

------- Comment #43 From Aiko Barz 2004-01-17 11:57:22 0000 -------
Broken builds:
All qmail-ebuilds

------- Comment #44 From Martin Holzer (RETIRED) 2004-01-19 11:25:22 0000 -------
coreutils-5.0.91-r4 is stable on x86

------- Comment #45 From Seemant Kulleen (RETIRED) 2004-01-19 14:47:27 0000 -------
but those syntax fixes should still go in

------- Comment #46 From David Röhr 2004-04-01 09:17:28 0000 -------
The -n switch also destroys all the sun-jdks as of now.

In each sun-jdk, SUN uses tail +345 and tail -1

tail -1 works, and the file gives a nice warning, but the script tailes terribly. And against the gentoo script, nothing works. This may be an error that should end up at the dev-java guys.

I've fixed it, with manually hacking the downloaded sun-jdks, and replaced the "tail +345" with "tail --lines=+345". This fixes one problem, but there still i some sync problems against the scripts from the gentoo developers. I guess this should end up in a patch though.

------- Comment #47 From David Röhr 2004-04-01 09:42:30 0000 -------
Forgot to mention

tail -1 file (works, but gives a warning that might break scripts, like the sun-jdks)
tail +1 file (doesn't work at all anymore, but works with "tail --lines=+1 file"). This breaks alot more than - that just gives a warning right now.

------- Comment #48 From David Röhr 2004-04-01 09:48:04 0000 -------
And yes, I will stop bombing you soon :) My testes was on amd64 with both
5.0.91-r4 and 5.2.0. Guess the same problem is in x86 though..

------- Comment #49 From Gregory P. Smith 2004-10-07 12:38:50 0000 -------
This is insane.  Other distros have all been smart enough to leave the default
behaviour of supporting the old style standard -123 way of telling head and
tail what to do without a stupid warning message to stderr.  *PLEASE* make it
the default so people will stop laughing at you and scripts will stop breaking.

head -123
tail -123
tail +321

those should all work forever on into the future.  its the way they have always
worked.
anything else is incompatible with the real world.

------- Comment #50 From SpanKY 2004-10-07 14:03:08 0000 -------
actually, before you start/continue anymore flames, realize the simple fact,
it's a bug

as David noted in comment #47, tail -# works, tail +# does not work

the compat patches are incomplete and no developers ever really noticed ...
i'll take a look at what i missed later

------- Comment #51 From SpanKY 2004-10-07 18:40:25 0000 -------
Bug 66713 handles the `tail +#` syntax fix

------- Comment #52 From John Mylchreest (RETIRED) 2004-12-01 11:27:38 0000 -------
I'm going to assume this is now being handled correctly and the bug can be
closed.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug