Closed Bug 185063 Opened 23 years ago Closed 22 years ago

when generating dependent libraries, 'cut' is used, and it cares about spaces, when it should care about whitespace

Categories

(www.mozilla.org :: General, defect)

x86
BSDI
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: lidl, Assigned: netscape)

References

()

Details

User-Agent: Mozilla/5.0 (X11; U; BSD/OS i386; en-US; rv:1.2.1) Gecko/20021204 Build Identifier: Mozilla/5.0 (X11; U; BSD/OS i386; en-US; rv:1.2.1) Gecko/20021204 In the "Building a Mozilla Release" document, there is a command line given for generating a list of dependent libraries for unix machines. It is requested the output for that command line is appended to the specific readme file for the build that you are constructing. That is all well and fine, however, the command line that is used: ldd mozilla-bin components/*.so | sort | uniq | grep = | grep -v "not found" | cut -f 3 -d " " | sort | uniq This command line has the unfortunately problem of relying on 'ldd' to only use spaces in its whitespace output, and ignores other types of whitespace characters, such as tab characters. Using a smarter tool, such as 'awk' would be a better way of doing this step. Simply replacing the 'cut -f 3 -d " "' with "awk '{print $3}'" will accomplish this goal. It will then treat whitespace as whitespace, and not care if it is made up with a combination of space and tab characters. This particular problem afftected me on BSD/OS 5.0, when attempting to package a recent version of the browser. On previous versions of BSD/OS, the ldd command only output spaces. On BSD/OS 5.0, the output is separated by a combination of spaces and tabs. Further savings can be realized by harnessing the power of awk more fully: ldd mozilla-bin components/*.so | awk '{if (/=/ && !/not found/) print $3}' | sort | uniq This gets rid of the two grep invocations as well. Getting rid of the first sort and uniq invocations is also reasonable -- awk is pretty fast at processing input, and not doing a first-pass reduction of the input data (the first sort | uniq) is reasonable. Reproducible: Always Steps to Reproduce: 1. Run the command line in the "Building a Release document" on BSD/OS 5.0 2. Note that it fails to produce a list of valid dependency libraries.
Yeah, this burned me on a BSD/OS 5.0 system. To be more specific about the exact nature of the problem, the BSD/OS 5.0 ldd outputs an additional SPACE character before the first non-whitespace output. This causes the cut to need to be "-f 4" to work. The suggested "awk {print $3}" however works just fine on BSD/OS 4.x and 5.0; as does the longer awk invocation to eliminate the use of grep.
-> mozilla.org
Assignee: seawood → endico
Status: UNCONFIRMED → NEW
Component: Build Config → webmaster@mozilla.org
Ever confirmed: true
Product: Browser → mozilla.org
QA Contact: granrose → imajes
Version: Trunk → other
The instructions have been updated to use the recommended awk sequence.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Actually, it appears that someone put an escaping bang (!) in the awk script, which is NOT needed (and actually fouls things up), since it is already inside a single-quoted string.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
QA Contact: imajes → stolenclover
->seawood since he fixed it last time
Assignee: endico → netscape
Status: REOPENED → NEW
The expression doesn't work on tcsh without escaping the bang. The page has been updated.
Status: NEW → RESOLVED
Closed: 23 years ago22 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
Product: mozilla.org → Websites
Component: www.mozilla.org → General
Product: Websites → www.mozilla.org
You need to log in before you can comment on or make changes to this bug.