tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Denying #!/usr/bin/env as a valid interpreter



Hi List

Each time I upgrade pkgsrc, I get annoyed by developer laziness to check
any new files for a valid python interpreter. This is because

#!/usr/bin/env python

Is the recommended way of calling python by upstream and
check-interpreter.mk allows it just because /usr/bin/env exists.
Sadly, no binary called python exists on pkgsrc - it's python2.6 for
example.

So I've attached a quick patch to deny the use of /usr/bin/env
and /bin/env. I would imagine this would stop a lot of packages
installing including some surprising ones like say glib2.

Comments?

Thanks

Roy

Index: mk/check/check-interpreter.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/check/check-interpreter.mk,v
retrieving revision 1.25
diff -u -r1.25 check-interpreter.mk
--- mk/check/check-interpreter.mk       11 Jan 2011 12:03:18 -0000      1.25
+++ mk/check/check-interpreter.mk       16 Apr 2011 20:05:06 -0000
@@ -5,6 +5,10 @@
 # have a "#!" line with a non-existent interpreter will generate an
 # error message if they are executable, and a warning message otherwise.
 #
+# Files are not allowed to use /bin/env or /usr/bin/env as an interpreter
+# due the use dynamic paths and package developers not checking that they work.
+# A classic example is: #!/usr/bin/env python
+#
 # User-settable variables:
 #
 # CHECK_INTERPRETER
@@ -62,7 +66,8 @@
                        continue;                                       \
                };                                                      \
                case "$$interp" in                                      \
-               "") continue;                                           \
+               "") continue;;                                          \
+               /bin/env|/usr/bin/env) ${DELAYED_ERROR_MSG} 
"[check-interpreter.mk] The interperter \"$$interp\" of 
\"${DESTDIR}${PREFIX}/$$file\" is not allowed.";; \
                esac;                                                   \
                                                                        \
                if { [ ! -f ${DESTDIR:Q}"$$interp" ] &&                 \


Home | Main Index | Thread Index | Old Index