Bug 157 - uniq returns only the first line
Summary: uniq returns only the first line
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.13.x
Hardware: Other Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-09 08:52 UTC by Volker Marks
Modified: 2009-03-10 11:44 UTC (History)
1 user (show)

See Also:
Host:
Target: ARM11
Build: 1.13.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Marks 2009-03-09 08:52:30 UTC
The "uniq" command returns (at least on ARM) only the first line of the input.

Reason: In "uniq_main" the variable "max_chars" is being initialized with -1. Then this variable is being passed to "strncmp". 

Quickfix: After changing "strncmp" to "strcmp" it works fine again...
Comment 1 Denys Vlasenko 2009-03-09 16:43:46 UTC
Does it work for you if you replace -1 with INT_MAX?
Comment 2 Volker Marks 2009-03-10 09:53:44 UTC
(In reply to comment #1)
> Does it work for you if you replace -1 with INT_MAX?
> 

Haven't tried it, but I'm pretty sure that it will also work as strncmp is basically working on our system...