factor buffers output when run interactively
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
coreutils |
Fix Released
|
Undecided
|
Unassigned | ||
coreutils (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
When the "factor" utility is run without any arguments, it reads numbers from stdin and writes the factors to stdout. One use case for this mode is to run factor in a terminal window and enter numbers manually. This worked well in coreutils 8.23 and earlier. However, in coreutils 8.25, the output of factor is buffered, making this mode of operation less useful.
Notice that in the logs for version 8.25, all of the output occurs after end-of-file has been reached on stdin.
I entered the following input:
factor --version
factor
5
7
9
^D
bash$ factor --version
factor (GNU coreutils) 8.23
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Paul Rubin, Torbjörn Granlund, and Niels Möller.
bash$ factor
5
5: 5
7
7: 7
9
9: 3 3
bash$
bash$ factor --version
factor (GNU coreutils) 8.25
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Paul Rubin, Torbjörn Granlund and Niels Möller.
bash$ factor
5
7
9
5: 5
7: 7
9: 3 3
bash$
ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: coreutils 8.25-2ubuntu2
ProcVersionSign
Uname: Linux 4.4.0-36-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.1
Architecture: amd64
CurrentDesktop: KDE
Date: Sun Sep 4 23:32:33 2016
EcryptfsInUse: Yes
InstallationDate: Installed on 2013-08-13 (1118 days ago)
InstallationMedia: Ubuntu 12.04.2 LTS "Precise Pangolin" - Release amd64 (20130213)
SourcePackage: coreutils
UpgradeStatus: No upgrade log present (probably fresh install)
Yes that operation was changed in 8.25 to ensure atomic output,
thus allowing one to run multiple factor processes in parallel
and collate the output.
I'll look at disabling this internal buffering if the output is line buffered
(which it will be if outputting to a terminal, or if stdbuf -oL is used)