On Tue, 1 Nov 2016 09:48:41 -0700 Francois Marier <franc...@debian.org>
wrote:
> On 2016-11-01 at 12:31:28, Jack.R wrote:
> > Not sure if this must be reported on email-reminder or lsb-release.
> 
> It looks like a bug in lsb-release since it's a Python backtrace and
> email-reminder is written in Perl, but if there's a way to
> work-around this bug in email-reminder, I'm happy to do it.
> 
> > In a root terminal, I got:
> > # su - email-reminder -s /bin/bash -c /usr/bin/lsb_release
> > No LSB modules are available.
> 
> I believe that's expected.
> 
> > # su - email-reminder -s /bin/bash -c `/usr/bin/lsb_release -a`
> > No LSB modules are available.
> > ID:: Distributor : commande introuvable
> 
> The problem here is the way the last parameter is escaped. Try this:
> 
>   sudo su - email-reminder -s /bin/bash -c "/usr/bin/lsb_release -a"
> 
> (with double quotes instead of backticks)
> 
> > # /usr/bin/lsb_release -a
> > No LSB modules are available.
> > Distributor ID: Debian
> > Description:    Debian GNU/Linux testing (stretch)
> > Release:        testing
> > Codename:       stretch
> 
> Ok, given that this works, what happens if you edit
> /usr/share/perl5/EmailReminder/Utils.pm and around line 140, change
> 
>   my $distro = `/usr/bin/lsb_release -s -d`; chomp $distro;
> 
> to this:
> 
>   my $distro = `/bin/sh -c "/usr/bin/lsb_release -s -d"`; chomp
> $distro;
> 
> Francois
> 
> -- 
> https://fmarier.org/
> 
> 

With double quotes instead of backticks
# sudo su - email-reminder -s /bin/bash -c "/usr/bin/lsb_release -a"
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux testing (stretch)
Release:        testing
Codename:       stretch

# /bin/sh -c "/usr/bin/lsb_release -s -d"
Debian GNU/Linux testing (stretch)

I made the change in /usr/share/perl5/EmailReminder/Utils.pm but
still get error
# /etc/cron.daily/email-reminder 
Traceback (most recent call last):
  File "/usr/bin/lsb_release", line 95, in <module>
    main()
  File "/usr/bin/lsb_release", line 59, in main
    distinfo = lsb_release.get_distro_information()
  File "/usr/lib/python3/dist-packages/lsb_release.py", line 341, in
get_distro_information distinfo = guess_debian_release()
  File "/usr/lib/python3/dist-packages/lsb_release.py", line 283, in
guess_debian_release rinfo = guess_release_from_apt()
  File "/usr/lib/python3/dist-packages/lsb_release.py", line 188, in
guess_release_from_apt releases = parse_apt_policy()
  File "/usr/lib/python3/dist-packages/lsb_release.py", line 171, in
parse_apt_policy close_fds=True).communicate()[0].decode('utf-8')
  File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'apt-cache'
Error: could not mail the reminder out


-- 
Jack.R

Reply via email to