cal output differs between 10.04.4 LTS and 12.04 LTS

Bug #1055007 reported by Joni Lahtinen
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
bsdmainutils (Debian)
Unknown
Unknown
bsdmainutils (Ubuntu)
New
Undecided
Unassigned

Bug Description

Raw outputs (terminal output looks the same for both but programs get it wrong):

10.04.4:

   September 2012
Su Mo Tu We Th Fr Sa
                   1
 2 3 4 5 6 7 8
 9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30

12.04:

   September 2012
Su Mo Tu We Th Fr Sa
                   1
 2 3 4 5 6 7 8
 9 10 11 12 13 14 15
16 17 18 19 20 21 22
_^H2_^H3 24 25 26 27 28 29
30

Also "diff -B <( cal ) <( cal -h )" differs on 12.04 but not on 10.04.4

Revision history for this message
Rolf Leggewie (r0lf) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. Unfortunately, we cannot work on this bug because your description didn't include enough information. You may find it helpful to read "How to report bugs effectively" http://www.chiark.greenend.org.uk/~sgtatham/bugs.html. We'd be grateful if you would then provide a more complete description of the problem.

In particular, I am not sure why you think that a difference in output between program releases would be a bug. Is one output wrong and the other is correct? Please give more detail.

FWIW, I can confirm that "diff -B <( cal ) <( cal -h )" differs on 12.04 but not on 10.04.4. Not sure where exactly the bug would be, though. In precise? In lucid? In both?

We have instructions on debugging some types of problems at http://wiki.ubuntu.com/DebuggingProcedures

At a minimum, we need:
1. the specific steps or actions you took that caused you to encounter the problem,
2. the behavior you expected, and
3. the behavior you actually encountered (in as much detail as possible).
Thanks!

Changed in bsdmainutils (Ubuntu):
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for bsdmainutils (Ubuntu) because there has been no activity for 60 days.]

Changed in bsdmainutils (Ubuntu):
status: Incomplete → Expired
Gary Peters (c-gary-e)
Changed in bsdmainutils (Ubuntu):
status: Expired → Confirmed
Revision history for this message
Gary Peters (c-gary-e) wrote :

I have existing scripts, many old and widely distributed, that were written using the stdout of "cal" as the stdin of another command. The problem (for existing scripts) is that cal changed its piped-output behavior by inserting extra underscore and backspace characters, which can cause problems for whatever command is reading cal's piped-output.

On Ubuntu 10.04 (and earlier) the cal's "-h" was automatically implied when redirecting cal's stdout, but Ubuntu 12.04/14.04 do not behave in the same manor.

This issue is not that cal has a beautified output when displayed on a terminal, rather the issue (and hence the bug) is that cal should intentionally not beautify the output when its stdout is not a terminal.

To see this, try the command on Ubuntu 12.04/14.04:
    cal | od -c
and notice the underscore and backspace characters (they do not occur on Ubuntu 10.04 when redirecting cal's stdout).

A simple example -- on Ubuntu 10.04 this works as expected:
    cal | sed 's/^/ /; s/$/ /' | grep -e " `date '+%e'` "
but to make it work on Ubuntu 12.04/14.04 now requires the explicit "-h" argument:
    cal -h | sed 's/^/ /; s/$/ /' | grep -e " `date '+%e'` "

The crude work-around that I have had to implemented (for script backwards compatibility with non-linux servers) is to replace usage like:
    cal 1 2000
with usage like:
    ( cal -h 1 2000 2> /dev/null || cal 1 2000 )

I have been using UNIX/Linux (and other flavors) for 34 years, and I would have never expected such a standard and universal UNIX/Linux command as "cal" to change in a manor that breaks existing scripts, especially when it is just a case of testing if stdout is attached to a terminal or not. Hence, I do not feel that it is a evolutionary growth of the "cal" command (for which old scripts just must be rewritten for the evolutionary good), but rather a bug that was not realized to be occurring.

Revision history for this message
Rolf Leggewie (r0lf) wrote :

Thank you for the explanation. I still don't see a bug. You will need to take this up with upstream. Ubuntu will not introduce a delta because of this.

Changed in bsdmainutils (Ubuntu):
status: Confirmed → Opinion
status: Opinion → New
Revision history for this message
Rolf Leggewie (r0lf) wrote :

I've changed my mind about this not being a bug. Nonetheless, you will need to get upstream to change this.

This problem has been reported to Debian for discussion.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=688078

Revision history for this message
Gary Peters (c-gary-e) wrote :

I appreciate you looking into this issue with "cal" again.

Even before I submitted my comment, I realized that this was an upstream issue rather than an Ubuntu issue. Even so, I figured that if I at least started at Ubuntu then someone from Ubuntu could point me to where I need to go next.

So, is the next logical step, which you have done, to report it to Debian for discussion? Or do I need to report this to some upstream entity, and can you recommend which upstream entity(s) would be?

Thanks -- to each and every person in the Ubuntu team -- your efforts are greatly appreciated every day.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.