[BusyBox 0006194]: sum -s prints an extra dash character (mismatch with coreutils)
bugs at busybox.net
bugs at busybox.net
Tue Nov 11 23:29:35 UTC 2008
A NOTE has been added to this issue.
======================================================================
http://busybox.net/bugs/view.php?id=6194
======================================================================
Reported By: pgbovine
Assigned To: BusyBox
======================================================================
Project: BusyBox
Issue ID: 6194
Category: Standards Compliance
Reproducibility: always
Severity: trivial
Priority: normal
Status: assigned
======================================================================
Date Submitted: 11-11-2008 12:46 PST
Last Modified: 11-11-2008 15:29 PST
======================================================================
Summary: sum -s prints an extra dash character (mismatch with
coreutils)
Description:
Seems trivial, but I don't know what the trailing '-' comes from or means
...
Coreutils behavior:
$ echo "hello" | sum -s
542 1
Busybox behavior:
$ echo "hello" | ./busybox sum -s
542 1 -
======================================================================
----------------------------------------------------------------------
Tito - 11-11-08 15:29
----------------------------------------------------------------------
'-' is a placeholder for the filename, in this case stdin.
if (!argv[0]) {
/* Do not print the name */
n = sum_file("-", type);
it could be probably easily fixed in:
static unsigned sum_file(const char *file, unsigned type)
{
#define buf bb_common_bufsiz1
unsigned long long total_bytes = 0;
int fd, r;
/* The sum of all the input bytes, modulo (UINT_MAX + 1). */
unsigned s = 0;
fd = open_or_warn_stdin(file);
if (fd == -1)
return 0;
+ if (file[0] == '-' && ! file[1])
+ file[0] = '\0';
while (1) {
Untested, just a hint.
Issue History
Date Modified Username Field Change
======================================================================
11-11-08 12:46 pgbovine New Issue
11-11-08 12:46 pgbovine Status new => assigned
11-11-08 12:46 pgbovine Assigned To => BusyBox
11-11-08 15:29 Tito Note Added: 0015514
======================================================================
More information about the busybox-cvs
mailing list