| Summary: | [PATCH] make cut(1) work with long lines | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Base System | Reporter: | dd <dd> | ||||
| Component: | bin | Assignee: | dd <dd> | ||||
| Status: | Closed FIXED | ||||||
| Severity: | Affects Only Me | ||||||
| Priority: | Normal | ||||||
| Version: | Unspecified | ||||||
| Hardware: | Any | ||||||
| OS: | Any | ||||||
| Attachments: |
|
||||||
State Changed From-To: open->analyzed Patch committed to -current. I'll MFC, or bug someone to MFC, it later. Responsible Changed From-To: freebsd-bugs->dd My patch, my commit. State Changed From-To: analyzed->closed MFC'd |
cut(1) cannot deal with lines longer than 2048 characters, and does not properly deal with files that do not have a trailing newline. Fix: The following patch fixes both of the cases described above. Note that specifying a list over 2048 on the command line (e.g., the -f option) still isn't supported, but at least cut(1) doesn't choke when you want the second token but feed it a few thousand characters in one line. How-To-Repeat: dima@spike% perl -e 'for ($i = 0; $i < 9000; $i++) { print "magic$i " }' > llt dima@spike% cut -d\ -f2 llt cut: llt: line too long. dima@spike% echo -n "file with no trailing newline" > ntn dima@spike% cut -d\ -f2 ntn cut: ntn: line too long. dima@spike%