Bug 15282 - Reports from cron are not readable "Unable to get Terminal Size"
Summary: Reports from cron are not readable "Unable to get Terminal Size"
Status: RESOLVED OLD
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: x86_64 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: All Packagers
QA Contact:
URL:
Whiteboard: MGA5TOO
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2015-02-13 18:36 CET by James Kerr
Modified: 2021-09-12 15:37 CEST (History)
8 users (show)

See Also:
Source RPM: cronie-1.4.12-2.mga5.src.rpm
CVE:
Status comment:


Attachments
Patch for urpm/download.pm (357 bytes, patch)
2016-02-05 14:29 CET, Deri James
Details | Diff

Description James Kerr 2015-02-13 18:36:47 CET
Messages produced by anacron when it completes a job are not being produced correctly. Instead, the message says:

Unable to get Terminal Size. The TIOCGWINSZ ioctl didn't work. The COLUMNS and 
LINES environment variables didn't work. The resize program didn't work. The 
stty program didn't work. at 
/usr/lib/perl5/vendor_perl/5.20.1/x86_64-linux-thread-multi/Term/ReadKey.pm line 
451.

So far as I can tell anacron is completing the jobs defined in anacrontab, it is just the reporting of the results that is not functioning correctly.

Messages from msec and from cron jobs set up using crontab-e are OK.




Reproducible: 

Steps to Reproduce:
Comment 1 James Kerr 2015-02-13 22:00:33 CET
More investigation indicates that the problem may lie with one of commands in /etc/cron.daily and not with anacron.

After I installed rkhunter, it's output is properly included in the message from anacron (after the message that I quoted above).

I'm closing this bug as invalid until I've completed some more tests.

Status: NEW => RESOLVED
Resolution: (none) => INVALID

Comment 2 James Kerr 2015-02-14 13:51:48 CET
To complete this report - the message quoted was caused by /etc/cron.daily/google-chrome. The only useful function that script performs is to set up the google-chrome repo in urpmi.cfg. Once that is done, I believe it is redundant. I deleted the script and the message no longer appears in anacron emails.
Comment 3 GG HH 2015-02-14 20:59:10 CET
I encoutered it from /usr/lib/perl5/vendor_perl/5.20.1/x86_64-linux-thread-multi/Term/ReadKey.pm (perl-Term-ReadKey-2.320.0-4.mga5) line 451
It looks likes it actually comes from the resize command which can't guess the column & row numbers... when called from in a non interactive context (crond)

i am not sure what is the correct fix.
Probably not calling resize when not in interactive mode.
At least not displaying an error message.

My temporary workaround is to comment the offending lines
        # warn "Unable to get Terminal Size."
        #  . join( "", map( " The $_ didn't work.", @fail ) );

My .02â¬

CC: (none) => boulshet

James Kerr 2015-06-25 12:29:37 CEST

Resolution: INVALID => (none)
Status: RESOLVED => REOPENED

James Kerr 2015-06-25 12:30:38 CEST

Summary: Reports from anacron are not readable => Reports from cron are not readable "Unable to get Terminal Size"

Comment 4 Luca Olivetti 2015-06-25 12:45:19 CEST
As I said on the mailing list, I have a cron job that notifies me of available updates:

#!/bin/sh
urpmi.update -q --update
urpmq --auto-select -f

and after I upgraded to mga5 started to sending me those messages.
For the time being I added COLUMNS and LINES to the script, but maybe commands that can be run non-interactively shouldn't use perl-Term-Readkey

Whiteboard: (none) => MGA5TOO
CC: (none) => luca

Comment 5 Christophe Macé 2015-07-05 12:55:18 CEST
My msec jobs also report this error since I upgraded to Mageia 5.

CC: (none) => mace.christophe

Comment 6 Stefan Puch 2015-07-29 09:45:09 CEST
I've got nearly the same context as Luca reported in Comment 4. A cron job the installs updates via urpmi via cron and the problem started after upgrading to MGA5-32.

That problem is also discussed here (for Term::ReadKey)

https://rt.cpan.org/Public/Bug/Display.html?id=105232

but the suggestion is again the same as Luca mentioned: "The bug is in the software that is using it and not in Term::ReadKey which, as implied by the name, requires there to be a controlling terminal."

The problem was also discussed on debian mailing list
https://lists.debian.org/debian-user/2015/02/msg00765.html

@Luca: Is it sufficient to just declare COLUMNS and LINES to the script or must they be exported as well? Maybe you could post your complete work around?

CC: (none) => s.puch

Comment 7 Stefan Puch 2015-07-29 10:21:37 CEST
Some further links/commentrs which might be helpful.
Debian had the same problem with Term::ReadKey in a package called needrestart

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=768124

They fixed it with a patch (Add patch 07-fix-warnings-without-tty to fix Perl warnings, if no TTY is available) which could be grabbed from 

http://http.debian.net/debian/pool/main/n/needrestart/needrestart_1.2-8+deb8u1.debian.tar.xz

I'm no perl expert, but maybe that fix could be applied to urpmi or cronie or whatever causes the problem here, too?
Comment 8 Luca Olivetti 2015-07-30 00:54:10 CEST
@Stefan, I exported them, i.e., I added these 2 lines to my script

COLUMNS=80 ; export COLUMNS
LINES=21; export LINES
Comment 9 w unruh 2016-01-05 07:27:08 CET
It really seems silly to be adding Columns and Lines when there is no terminal to have any columns or line. The perl Term::ReadKey (or just Term) should be testing if there is any terminal and jumping ship if there is not. Sounds like the kind of coding which produces security bugs which should be fixed at the one point, rather than fixing the uncountable number of programs that use this.

CC: (none) => unruh

Comment 10 Deri James 2016-02-05 14:29:26 CET
Created attachment 7411 [details]
Patch for urpm/download.pm

I observed the same problem when cron.daily was run by anacron. The attached patch to urpm/download,pm fixed it for me.

CC: (none) => deri

Comment 11 Rémi Verschelde 2016-02-05 14:52:09 CET
@Thierry: See the proposed patch in comment 10.

Keywords: (none) => PATCH
CC: (none) => thierry.vignaud

Comment 12 Samuel Verschelde 2016-11-01 11:49:04 CET
Assigning to maintainer Shlomi Fish. There is a patch in comment 10.

Assignee: bugsquad => shlomif
Status: REOPENED => NEW

Comment 13 w unruh 2016-11-07 10:51:51 CET
In urpmi  8.06.1-1.mga5 it is line 844 or 843 (it seems to differ on different installations)  rather than 823 in patch  in comment 10 that must be changed.
Comment 14 Marja Van Waes 2021-09-12 15:37:28 CEST
This report saw no action since almost five years ago, so assuming the issue got fixed with a newer version of Cronie and closing this report.

Feel free to reopen if the issue persists in current cauldron or Mageia 8.

Resolution: (none) => OLD
Status: NEW => RESOLVED
CC: (none) => marja11
Assignee: shlomif => pkg-bugs


Note You need to log in before you can comment on or make changes to this bug.