Bug 59396
| Summary: | find-requires: head: invalid option -- 1 | ||
|---|---|---|---|
| Product: | [Retired] Red Hat Linux | Reporter: | Joop Susan <jgsusan3> |
| Component: | rpm | Assignee: | Jeff Johnson <jbj> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.2 | ||
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | i386 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2002-02-10 20:57:57 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Joop Susan
2002-02-06 23:13:10 UTC
I'm not sure what to tell you, as I build daily using head(1) from the 7.2 textutils package without problem. Can you provide more information? I've turned my system upside-down and found that it is indeed a problem with
my system.
'which head' returns '/usr/bin/head'. RedHat 7.2 aliasses 'which'
(in /etc/profile.d/which-2.sh) to
'alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'.
This alias also only returned the expected '/usr/bin/head'.
Bash' 'type -all head' on the other hand, also found a bash function that
redefined 'head' to 'head () { command head --lines=30 "$@" }', obviously to
extract a few more lines than the default 10. This knit was hiding in
'/root/.bashrc'.
That happens if you copy rc-files from an old system to the new one ;-)
The '-1' switch that RedHat's 'rpm' uses does work, but only if it is the
only or the first option.
'/usr/bin/head -1 /etc/passwd' works
'/usr/bin/head -1 -v /etc/passwd' works too, but
'/usr/bin/head -v -1 /etc/passwd' does not.
So the '-1' option is breakable.
'/usr/bin/head --lines=1 --verbose /etc/passwd' works.
'/usr/bin/head --verbose --lines=1 /etc/passwd' works.
So the '--lines=1' option seem more robust that the '-1' option.
The "bug" was the fact that I added an option before the '-1' in the
function. So to get rid of it on my system only needed getting rid op the
function and the change from '-1' to '--lines=1' was not really needed.
My 'build' broke because '/usr/bin/head --lines=30 -1 /etc/passwd' does not
work. My solution of using the '--lines=1' option worked because
'/usr/bin/head --lines=30 --lines=1 /etc/passwd' does give the required
result (one line) and not an error message.
Although the fault turned out to be mine, I would nevertheless prefer to use
'--lines=1' given the fact that is is apparently more robust.
Using '-n 1' works as well as '--lines=1'.
I hope this time my testing was more thorough...
I'll rename my 'head' function to 'h30' ;-)
While I can appreciate your pain in debugging, the underlying problem is that of shell aliases are kinda borken in unix. Even though I can contemplate "hardening" of rpm scripts to avoid the problem by either 1) using the long option variant (as you've suggested) 2) hardwiring a /usr/bin/head path to avoid aliases I don't believe that the effort is worthwhile: there's no clear win AFAICT, it's just life with unix shell. |