SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2012-05-20 12:18:50

oylenshpeegul
Member
From: Maryland, USA
Registered: 2012-01-01
Posts: 37
Website

env and system scripts

I noticed cb-fortune is a Python script with /usr/bin/env on the shebang line (er, crunchbang line :). While env is a wonderful thing for user scripts, it's usually a mistake for system scripts. If someone installs another python higher in their path (such as a newer version in /usr/local/bin), the script breaks.

The problem is particularly acute for Python scripts, since Python 3 is not backwards compatible with Python 2, so a Python 2 script trolling around for any old python interpreter with env might find a compiler that doesn't even understand it. But in principle it's the same issue for all scripts.

I've changed the shebang line in cb-fortune on my systems

$ head -1 /usr/bin/cb-fortune
#!/usr/bin/python

but all of these other scripts in /usr/bin are either broken already or bugs waiting to happen

$ grep '^#!/usr/bin/env ' /usr/bin/*
/usr/bin/catfish:#!/usr/bin/env bash
/usr/bin/cb-aerosnap:#!/usr/bin/env python
/usr/bin/cb-exit:#!/usr/bin/env python
/usr/bin/cb-hotcorners:#!/usr/bin/env python
/usr/bin/cb-sshconfig-pipemenu:#!/usr/bin/env python
/usr/bin/gdbus-codegen:#!/usr/bin/env python
/usr/bin/gsettings-schema-convert:#!/usr/bin/env python
/usr/bin/gtk-builder-convert:#!/usr/bin/env python
/usr/bin/pcf2vpnc:#!/usr/bin/env perl
/usr/bin/tintwizard.py:#!/usr/bin/env python
grep: /usr/bin/X11: Is a directory
/usr/bin/xkeystone:#!/usr/bin/env nickle

I've run into this problem several times before

https://bugs.launchpad.net/ubuntu/+sour … bug/892748

The meta-issue, I guess, is that debian packaging doesn't complain more when you try to add such a script without rewriting the shebang line. If you're checking that something exists and meets all of your dependencies, then that's the thing you should be writing on the shebang line.

Last edited by oylenshpeegul (2012-05-20 12:28:59)

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo