Bug#1055197: cron: "crontab -l" background color output is still incorrect

2023-11-02 Thread Vincent Lefevre
On 2023-11-01 23:08:53 +0100, Vincent Lefevre wrote:
> "crontab -l" still incorrectly outputs a yellow background color where
> it shouldn't: when scrolling is involved[*], the trailing whitespace
> in a line that follows a comment (possibly the prompt line) has a
> yellow background.

In crontab.c:

while (EOF != (ch = get_char(f)))
  switch (ch) {
  case '\b':
putchar('\\'); putchar('b'); break;
  case '\r':
putchar('\\'); putchar('r'); break;
  default:
if(new_line && isatty(STDOUT)){
  if(ch == '#'){
printf(COMMENT_COLOR);
  } else {
printf(RESET_COLOR);
  }
}
putchar(ch);
new_line = ch == '\n';
  }

I think that the issue is that the RESET_COLOR is sent *after*
the \n. Why???

If sent after, the following line will also have the comment
background in case of scrolling. If sent before, this should
be OK in most cases, but perhaps not if there is a line whose
number of characters is equal to the terminal width.

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



Bug#1055197: cron: "crontab -l" background color output is still incorrect

2023-11-01 Thread Vincent Lefevre
Package: cron
Version: 3.0pl1-178
Severity: normal

"crontab -l" still incorrectly outputs a yellow background color where
it shouldn't: when scrolling is involved[*], the trailing whitespace
in a line that follows a comment (possibly the prompt line) has a
yellow background.

BTW, among the programs that colorize their output, crontab is the
only one that does not use the default background color.

[*] For instance, when the command is entered at the bottom line of
the terminal.

-- Package-specific info:
--- EDITOR:
not set

--- /usr/bin/editor:
/usr/bin/emacs-gtk

--- /usr/bin/crontab:
-rwxr-sr-x 1 root crontab 47840 2023-11-01 17:56:35 /usr/bin/crontab

--- /var/spool/cron:
drwxr-xr-x 5 root root 4096 2015-10-06 17:16:02 /var/spool/cron

--- /var/spool/cron/crontabs:
drwx-wx--T 2 root crontab 4096 2023-11-01 19:33:07 /var/spool/cron/crontabs

--- /etc/cron.d:
drwxr-xr-x 2 root root 4096 2023-11-01 22:22:15 /etc/cron.d

--- /etc/cron.daily:
drwxr-xr-x 2 root root 4096 2023-11-01 22:22:15 /etc/cron.daily

--- /etc/cron.hourly:
drwxr-xr-x 2 root root 4096 2023-11-01 22:22:15 /etc/cron.hourly

--- /etc/cron.monthly:
drwxr-xr-x 2 root root 4096 2023-11-01 22:22:15 /etc/cron.monthly

--- /etc/cron.weekly:
drwxr-xr-x 2 root root 4096 2023-11-01 22:22:15 /etc/cron.weekly


-- System Information:
Debian Release: trixie/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'stable-updates'), (500, 
'stable-security'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
merged-usr: no
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.5.0-3-amd64 (SMP w/12 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=POSIX, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages cron depends on:
ii  cron-daemon-common   3.0pl1-178
ii  init-system-helpers  1.64
ii  libc62.37-12
ii  libpam-runtime   1.5.2-9.1
ii  libpam0g 1.5.2-9.1
ii  libselinux1  3.5-1
ii  sensible-utils   0.0.20

Versions of packages cron recommends:
ii  exim4-daemon-light [mail-transport-agent]  4.97~RC3-1

Versions of packages cron suggests:
ii  anacron2.3-39
pn  checksecurity  
ii  logrotate  3.21.0-1

Versions of packages cron is related to:
pn  libnss-ldap   
pn  libnss-ldapd  
pn  libpam-ldap   
pn  libpam-mount  
pn  nis   
pn  nscd  

-- no debconf information

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)