Bug 238487 - deskutils/conkyemail: Calls /usr/bin/env python at runtime
Summary: deskutils/conkyemail: Calls /usr/bin/env python at runtime
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Kai Knoblich
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-11 07:57 UTC by Katsuyuki Miyoshi
Modified: 2019-11-22 10:58 UTC (History)
3 users (show)

See Also:
kai: merge-quarterly+


Attachments
Makefile.patch (570 bytes, patch)
2019-06-11 07:57 UTC, Katsuyuki Miyoshi
no flags Details | Diff
conkyemail-2.15.patch (5.17 KB, patch)
2019-06-15 20:47 UTC, Kai Knoblich
kai: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Katsuyuki Miyoshi 2019-06-11 07:57:45 UTC
Created attachment 204977 [details]
Makefile.patch

I get an error when I execute conkyemail.

============================================================
% conky -D -c myconkyEmail.conf
...
  File "/usr/local/share/conkyemail/conkyEmail.py", line 167
    except Exception, e:
                    ^
SyntaxError: invalid syntax
...
============================================================

This is because conkyemail used python of python3.6.

============================================================
% grep python /usr/local/bin/conkyEmail
$PYTHONPATH /usr/bin/env python /usr/local/share/conkyemail/conkyEmail.py "$@"
% python --version
Python 3.6.8
% pkg info 'python*'
python-3.6_3,2
python2-2_3
python27-2.7.16_1
python3-3_3
python36-3.6.8_2
============================================================
(PYTHON_DEFAULT=3.6 is the current default.)

USES=python:2.7 is specified in conkyemail/Makefile, and conkyemail needs to use python2.7.

Attach a simple patch to use ${PYTHON_VERSION}.

Thanks.
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2019-06-11 08:01:19 UTC
Thank you for the report Katsuyuki.

The change should probably take the form of using USES=shabangfix, rather than a REINPLACE_CMD command
Comment 2 Katsuyuki Miyoshi 2019-06-12 06:37:34 UTC
(In reply to Kubilay Kocak from comment #1)
Yes, Please implement more appropriate method.

But more specifically, conkyEmail(the original of conkyemail_2.07.tar.gz) is as follows.

========================================
% cat src/conkyEmail
#! /bin/sh
cd /usr/share/conkyemail/
$PYTHONPATH /usr/bin/python /usr/share/conkyemail/conkyEmail.py "$@"
========================================

This is not python shebang. Are there other ports that handle this case well?

(By the way, it is a known original bug that $PYTHONPATH is here.)

Thanks.
Comment 3 Kai Knoblich freebsd_committer 2019-06-13 08:24:01 UTC
(In reply to Katsuyuki Miyoshi from comment #2)

I did some improvements together with your patch because the port was in a rather bad shape.

Would you like to adopt the port? If so, I'll add your Bugzilla email address to the MAINTAINER field.
Comment 4 Katsuyuki Miyoshi 2019-06-15 09:37:08 UTC
(In reply to Kai Knoblich from comment #3)
That's fine with me.

Please use katsubsd@gmail.com for my email address in the MAINTAINER field. I will also change my Bugzilla email address to this one.
Comment 5 Katsuyuki Miyoshi 2019-06-15 12:51:23 UTC
(In reply to Katsuyuki Miyoshi from comment #4)
I have changed my Bugzilla email address to katsubsd@gmail.com.
Comment 6 Kai Knoblich freebsd_committer 2019-06-15 20:47:04 UTC
Created attachment 205084 [details]
conkyemail-2.15.patch

(In reply to Katsuyuki Miyoshi from comment #5)

Hi Katsuyuki,

thank you for taking maintainership! Meanwhile I did some research and discovered that the latest release of desktutils/conkyemail is 2.15.

I attached a new patch for 2.15 with all the required fixes/dependencies to make it work but I haven't tested it fully regarding the runtime.

Can you please test the patch on occasion if everything works for you? As soon as I receive a short feedback from you I'll commit it then.
Comment 7 Katsuyuki Miyoshi 2019-06-17 10:39:30 UTC
(In reply to Kai Knoblich from comment #6)
Great! It works well with conkyemail-2.15.patch.

If I have to say something,

1) conkyemail will not need the conky command for RUN_DEPEND.

  Conkyemail actually works independently of conky.

2) If we use conkyemail_2.15, we would like to use conkykeyring.

  The keyring function used in conkyemail_2.15 will be expected to use conkykeyring (https://launchpad.net/~conky-companions/+archive/ubuntu/ppa/+sourcefiles/conkykeyring/1.01/conkykeyring_1.01.tar.gz).
  However, conkykeyring does not exist in FreeBSD ports collection.

Thanks.
Comment 8 Kai Knoblich freebsd_committer 2019-06-17 11:31:40 UTC
(In reply to Katsuyuki Miyoshi from comment #7)

Thank you for testing the update and your suggestions. Point 1) can be easily fixed and I'll do that when committing the patch.

Point 2) should be also no problem. Question here is: Would you like to give it a try to port conkykeyring by yourself? If so, please open a new PR with the attached patch / shar file.

If not, it's also fine. Then I'll add that port during this week to the ports tree.

Don't hesitate to ask if there are any questions.
Comment 9 Katsuyuki Miyoshi 2019-06-18 08:32:31 UTC
(In reply to Kai Knoblich from comment #8)
Thank you for your response.

> Would you like to give it a try to port conkykeyring by yourself?

I'm afraid it is a little difficult for me. I would be grateful if you would port conkykeyring.
Comment 10 commit-hook freebsd_committer 2019-06-23 22:32:53 UTC
A commit references this bug:

Author: kai
Date: Sun Jun 23 22:32:34 UTC 2019
New revision: 504995
URL: https://svnweb.freebsd.org/changeset/ports/504995

Log:
  deskutils/conkyemail: Fix invocation of Python script at runtime

  Since the default version of Python has been switched to 3.6 in r498529 the
  script "conkyEmail.py" that is invoked by the shell script "conkyEmail"
  fails at runtime due incompatible code.

  This occurs only if the Python meta port is also installed otherwise it
  won't start at all due a hardcoded reference (= /usr/bin/env python) in the
  shell script, thus:

  * Update and simplify the patch for "conkyEmail" by using placeholders for
    the Python interpreter and ${DATADIR} that will be replaced by the
    post-patch target. [1]

  Also while I'm here:
  * Silence all commands of the post-patch target to reduce cluttering of
    logfiles
  * Add license information
  * Pet portlint

  PR:		238487
  Submitted by:	Katsuyuki Miyoshi <katsubsd@gmail.com> (initial patch)
  MFH:		2019Q2 (blanket, runtime fix and framework compliance)

Changes:
  head/deskutils/conkyemail/Makefile
  head/deskutils/conkyemail/files/patch-conkyEmail
Comment 11 commit-hook freebsd_committer 2019-06-23 22:39:00 UTC
A commit references this bug:

Author: kai
Date: Sun Jun 23 22:38:06 UTC 2019
New revision: 504996
URL: https://svnweb.freebsd.org/changeset/ports/504996

Log:
  MFH: r504995

  deskutils/conkyemail: Fix invocation of Python script at runtime

  Since the default version of Python has been switched to 3.6 in r498529 the
  script "conkyEmail.py" that is invoked by the shell script "conkyEmail"
  fails at runtime due incompatible code.

  This occurs only if the Python meta port is also installed otherwise it
  won't start at all due a hardcoded reference (= /usr/bin/env python) in the
  shell script, thus:

  * Update and simplify the patch for "conkyEmail" by using placeholders for
    the Python interpreter and ${DATADIR} that will be replaced by the
    post-patch target. [1]

  Also while I'm here:
  * Silence all commands of the post-patch target to reduce cluttering of
    logfiles
  * Add license information
  * Pet portlint

  PR:		238487
  Submitted by:	Katsuyuki Miyoshi <katsubsd@gmail.com> (initial patch)
  Approved by:	ports-secteam (blanket: runtime fix, framework compliance)

Changes:
_U  branches/2019Q2/
  branches/2019Q2/deskutils/conkyemail/Makefile
  branches/2019Q2/deskutils/conkyemail/files/patch-conkyEmail
Comment 12 Kai Knoblich freebsd_committer 2019-06-23 22:43:48 UTC
(In reply to Katsuyuki Miyoshi from comment #9)

The fix for the runtime has been applied to /head and the 2019Q2 branch. deskutils/conkyemail should be usable again in its current version.

The next steps are now:

- I'll soon add the "conkykeyring" port to the Ports tree.
- Once that port has landed I'll update deskutils/conkyemail to the latest version and add you as maintainer for it.
Comment 13 Katsuyuki Miyoshi 2019-06-24 13:13:45 UTC
(In reply to Kai Knoblich from comment #12)
It's working!
Thanks.
Comment 14 Kai Knoblich freebsd_committer 2019-08-03 21:27:49 UTC
(In reply to Katsuyuki Miyoshi from comment #13)

Thank you for the feedback, it's nice to hear that it's working again. Meanwhile I've contacted upstream to ask about the actual state of all those tools for conky.

They weren't updated since 2013 and they don't seem to be compatible with later versions of Python 3. In my opinion it doesn't make much sense to add Python 2.7 only ports to the ports tree since Python 2.7 will be EOL to the end of this year.

Once I get some info from upstream I'll let you know asap.
Comment 15 Katsuyuki Miyoshi 2019-08-05 13:10:20 UTC
(In reply to Kai Knoblich from comment #14)
I was also worried that they have not been updated for a long time.
I can give up using conkyemail, but I hope there is good news.

Thanks.
Comment 16 Kai Knoblich freebsd_committer 2019-11-19 08:59:56 UTC
(In reply to Katsuyuki Miyoshi from comment #15)

Apparently upstream has abandoned conkyemail because I haven't received a reply yet and the repository wasn't updated for a long time.

I would mark the port as deprecated without an expiration date as deskutils/conkyemail works fine as long as Python 2.7 is present in the ports tree.
Comment 17 Katsuyuki Miyoshi 2019-11-20 06:41:32 UTC
(In reply to Kai Knoblich from comment #16)
I understand.
Comment 18 commit-hook freebsd_committer 2019-11-22 10:50:45 UTC
A commit references this bug:

Author: kai
Date: Fri Nov 22 10:50:39 UTC 2019
New revision: 518140
URL: https://svnweb.freebsd.org/changeset/ports/518140

Log:
  deskutils/conkyemail: Mark as DEPRECATED

  * Deprecate the port because the upstream repository hasn't changed since 6+
    years and the scripts aren't compatible with Python 3.

  * Don't set an expiration date for now as it runs fine as long as Python 2.7
    is present in the Ports tree.

  PR:		238487

Changes:
  head/deskutils/conkyemail/Makefile
Comment 19 Kai Knoblich freebsd_committer 2019-11-22 10:56:29 UTC
Comment on attachment 205084 [details]
conkyemail-2.15.patch

^ Triage: Set maintainer-approval to '+' as it's given implicitly by portmgr for unmaintained ports.
Comment 20 Kai Knoblich freebsd_committer 2019-11-22 10:58:37 UTC
(In reply to Katsuyuki Miyoshi from comment #17)

The port is now deprecated but can be used as long as Python 2.7 is available in the ports tree.

Once again thanks for reporting the issue with the broken runtime!