Bug 901935

Summary: cal (linux calendar utility) has lost newlines (\n) chars
Product: [Fedora] Fedora Reporter: Guido <rds1944>
Component: util-linuxAssignee: Karel Zak <kzak>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 18CC: jonathan, kzak, mluscon, pizza, tomi.ollila
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-26 14:55:02 EST Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Guido 2013-01-19 21:48:59 EST
cal @ a shell prompt gives correct display of the current month as a 2D array.

cal > month.txt produces a file with 1 line string. (no \n for each week.)

cal | less shows the same as creating a txt file.

This is an error!

Found in Fedora 18.

Absolutely reproducible.
Comment 1 tomi ollila 2013-01-21 22:04:22 EST
I've noticed the same.

output contains all non-newline characters in one line and then all the
newlines that should be between lines...


When running

script -c cal

The typescript has everything in order. I run this to see whether there
were some control characters in output. Nope

Also, 

env -i /bin/cal          -- works OK
env -i /bin/cal  | cat   -- fails.

output of the latest:
---8<-------8<------8<------8<------8<-----8<---
    January 2013    Su Mo Tu We Th Fr Sa       1  2  3  4  5 6  7  8  9 10 11 1213 14 15 16 17 18 1920 21 22 23 24 25 2627 28 29 30 31









----8<------8<------8<------8<------8<-----8<---
Comment 2 Guido 2013-01-21 22:13:33 EST
Thanks for the verification of this bug.

I, too, tried, in vain, to find some control chars with a variety of tools & never found any.

This utility used to work.

I looked at the src.rpm & noticed some comments that the entire code was rewritten in September 2012. I cannot see why. The prevous versions functioned just fine.
Comment 3 Karel Zak 2013-01-26 14:55:02 EST

*** This bug has been marked as a duplicate of bug 896447 ***