script headers and execute permission

Bug #142968 reported by Tim Peters
2
Affects Status Importance Assigned to Milestone
ZConfig
Fix Released
Low
Unassigned
zdaemon
Invalid
Low
Unassigned

Bug Description

From John Belmonte, on the zodb-dev list; this involves more than one package:

"""
I'd like to see the following issues regarding script headers and execute permission cleaned up in the ZODB distribution.

Has a script header, but shouldn't:

   /usr/lib/python2.3/site-packages/zdaemon/__init__.py

Executable, but missing script header:

   /usr/bin/zeoctl.py

Have script header, but are not executable (for consistency with similar files, script header should probably be removed):

   /usr/lib/python2.3/site-packages/ZEO/simul.py
   /usr/lib/python2.3/site-packages/ZEO/stats.py
   /usr/lib/python2.3/site-packages/ZODB/tests/dangle.py
   /usr/lib/python2.3/site-packages/zdaemon/tests/nokill.py
   /usr/lib/python2.3/site-packages/ZConfig/tests/runtests.py
"""

Tags: bug zope
Revision history for this message
Tim Peters (tim-one) wrote :

I removed from #! from zdaemon's __init__.py.

Revision history for this message
Tim Peters (tim-one) wrote :

Added #! to zeoctl.py on HEAD.

stats.py is intended to be run directly from a shell, ditto simul.py and dangle.py, so it's appropriate that they have #! lines. Added them to setup.py's "scripts" list, also on HEAD.

Leaving remaining zdaemon and ZConfig files to someone else.

Revision history for this message
John Belmonte (john-neggie) wrote :

> = Comment - Entry #3 by tim_one on May 24, 2004 4:14 pm
> stats.py is intended to be run directly from a shell, ditto simul.py and
> dangle.py, so it's appropriate that they have #! lines. Added them to
> setup.py's "scripts" list, also on HEAD.

When a script is installed into /usr/bin, there is a responsibility associated with that. Distributions such as Debian have policies requiring every command in /usr/bin to have a man page. So someone will have to bear the burden of maintaining a man page, either the ZODB team or the distribution packager, for each item you add to the scripts list. Also you have to worry about command name collisions, which I've pointed out elsewhere.

I don't think every .py file in the ZODB distribution that can be run directly from the shell should be installed into /usr/bin. The precedent seems to already exist: there are scripts in the various test directories which aren't installed into /usr/bin (e.g., ZEO/tests/speed.py).

I think one way to go about resolving all of this is to make sure things like simul.py, which would rarely get used by a normal user, are properly located in a test directory. Furthermore, the scripts in the test directories should not have headers or execute permission set, and should not be installed into /usr/bin. They are tests and experiments, and it's probably best to avoid having users mistake them for published and supported command line interfaces.

Revision history for this message
Tim Peters (tim-one) wrote :

Sorry, this stemmed from my near-total ignorance of what distutils does on non-Windows systems. I removed simul, stats and dangle from the distutils scripts= argument again, and removed their #! lines. I still have no idea how distutils decides whether to set the execute bit, so if that has to do with more than just being an argument to scripts=, nothing has changed there.

Revision history for this message
John Belmonte (john-neggie) wrote :

> = Comment - Entry #2 by tim_one on May 24, 2004 3:41 pm
>
> I removed from #! from zdaemon's __init__.py.

This does not seem to be the case-- please double check.

In addition, the script headers in the following still need to be removed:

 /usr/lib/python2.3/site-packages/zdaemon/tests/nokill.py
 /usr/lib/python2.3/site-packages/ZConfig/tests/runtests.py

With that, I think this bug can be closed.

In the future, I think it would be good to have the policy of script files reflected by their location in the source tree. For example: 1) all stable user commands should be placed in src/scripts and enumerated in the setup.py scripts list, and a commitment be made to supporting man pages; 2) all experimental user commands should be placed in src/scripts/experimental and not put in the scripts list; 3) unit test scripts can be left where they are; 4) no script in the library tree should have a script header.

Revision history for this message
Tim Peters (tim-one) wrote :

The cross-linking of modules we did in CVS wasn't done in SVN. I guess you're looking at the *copy* of zdaemon from a ZODB checkout. If so, that's got nothing to do with the current state of the zdaemon package. zdaemon has its own, distinct repository under SVN, and that's where the __init__.py change was made. That won't show up in ZODB unless/until someone makes time to make a new copy of zdaemon into ZODB.

As I said earlier, I'm leaving other zdaemon and ZConfig changes to someone else. Those packages are used by ZODB, but aren't part of the ZODB project, and I don't normally work on them.

Revision history for this message
Tres Seaver (tseaver) wrote :

Not a Zope2 issue.

affects: zope2 → zdaemon
Changed in zdaemon:
importance: Medium → Undecided
Revision history for this message
Fred Drake (fdrake) wrote :

ZConfig/tests/runtests.py has not been included in recent ZConfig releases.

This report no longer pertains to ZConfig.

Changed in zconfig:
status: New → Fix Released
importance: Undecided → Low
Changed in zdaemon:
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Colin Watson (cjwatson) wrote :

The zdaemon project on Launchpad has been archived at the request of the Zope developers (see https://answers.launchpad.net/launchpad/+question/683589 and https://answers.launchpad.net/launchpad/+question/685285). If this bug is still relevant, please refile it at https://github.com/zopefoundation/zdaemon.

Changed in zdaemon:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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