• Re: On the sensibility of portable scripts

    From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.os.linux.misc on Mon Apr 27 08:12:57 2026
    From Newsgroup: comp.os.linux.misc

    On Mon, 27 Apr 2026 06:19:09 -0000 (UTC), Lew Pitcher wrote:

    On Thu, 23 Apr 2026 22:13:19 +0000, Lew Pitcher wrote:

    When writing scripts for distribution, it seems to me to be common
    sense to write those scripts in a manner such that they need as
    little customization as possible. You cannot know all the quirks of
    the environment in which it will run, but you can dictate some
    minimum requirements for the script.

    Assuming a minimally GNU-compatible userland would seem to be a safe
    bet. In the bad old days, you had to contend with bugs and quirks of a
    dozen different proprietary Unix systems <https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.73/html_node/Portable-Shell.html>.
    Thankfully, these have all gone extinct.

    If, for instance, you write a Perl or Python script for distribution,
    it must not, to be useful to the intended audience, assume much more
    than the common components of the selected language; a Python 3 script
    won't be much use on a system that only has Python 2 installed, unless
    it restricts itself to the subset of Python 3 syntax and features that
    are common with Python 2.

    I would not bother maintaining compatibility with any version of
    either Perl or Python that no longer gets official support from
    upstream.

    For example, the last 2.x version of Python lost support over 6 years
    ago. For Python 3, the oldest currently-maintained version is 3.10.
    And going by past schedules, that will likely fall out of support
    sometime around October this year.

    While there is, AFAIK, no "minimum subset" defined for Python or Perl ...

    For Python, I assume the standard library
    <https://docs.python.org/3/library/> is available. If I need anything
    beyond that, I make a point of mentioning in the README or header
    comments or suchlike.
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Carlos E.R.@robin_listas@es.invalid to comp.os.linux.misc on Mon Apr 27 12:42:38 2026
    From Newsgroup: comp.os.linux.misc

    On 2026-04-27 10:12, Lawrence D’Oliveiro wrote:
    On Mon, 27 Apr 2026 06:19:09 -0000 (UTC), Lew Pitcher wrote:


    If, for instance, you write a Perl or Python script for distribution,
    it must not, to be useful to the intended audience, assume much more
    than the common components of the selected language; a Python 3 script
    won't be much use on a system that only has Python 2 installed, unless
    it restricts itself to the subset of Python 3 syntax and features that
    are common with Python 2.

    I would not bother maintaining compatibility with any version of
    either Perl or Python that no longer gets official support from
    upstream.

    For example, the last 2.x version of Python lost support over 6 years
    ago. For Python 3, the oldest currently-maintained version is 3.10.
    And going by past schedules, that will likely fall out of support
    sometime around October this year.

    My system still has python 2 installed.

    Scripts that I have seen do not specify versions, but they can.

    #!/usr/bin/env python3
    --
    Cheers, Carlos.
    ES🇪🇸, EU🇪🇺;
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Carlos E.R.@robin_listas@es.invalid to comp.os.linux.misc on Mon Apr 27 13:07:27 2026
    From Newsgroup: comp.os.linux.misc

    On 2026-04-27 08:19, Lew Pitcher wrote:
    On Thu, 23 Apr 2026 22:13:19 +0000, Lew Pitcher wrote:

    On Thu, 23 Apr 2026 23:05:14 +0200, Carlos E.R. wrote:

    [snip]
    What is not right is declare in a script that it uses the common shell,
    and then have bashisms inside.

    Agreed. That's why my script does /not/ have bashisms inside.

    It uses the (POSIX shell) common subset that ash, bash, dash, ksh,
    and zsh all support.

    When writing scripts for distribution, it seems to me to be
    common sense to write those scripts in a manner such that they
    need as little customization as possible. You cannot know all
    the quirks of the environment in which it will run, but you can
    dictate some minimum requirements for the script.

    If, for instance, you write a Perl or Python script for distribution,
    it must not, to be useful to the intended audience, assume much more
    than the common components of the selected language; a Python 3 script
    won't be much use on a system that only has Python 2 installed, unless
    it restricts itself to the subset of Python 3 syntax and features that
    are common with Python 2. Similarly, a bash script won't be of much use
    on a system that only has Korn shell installed, if it uses features
    only available in bash.

    I disagree. A script published for bash, will be of use on any machine
    that has bash.

    On your python script example you talked about versions of python, not
    about having a different interpreter like perl. If python is not
    installed, you see no problem demanding they install python.

    Here, it is the same. You can not talk of having korn instead of bash,
    when the script clearly asks for bash.

    Potatoes and lemons.

    Now, if the scripts asks for "shell", that's a different thing.


    ...

    While some will argue against this, for their own reasons, I will
    continue to distribute POSIX shell compatible scripts.

    For what it's worth.

    That's fine, as long as the SHEBANG writes "sh".
    --
    Cheers, Carlos.
    ES🇪🇸, EU🇪🇺;
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Ian@gay@sfuu.ca to comp.os.linux.misc on Mon Apr 27 09:43:06 2026
    From Newsgroup: comp.os.linux.misc

    Carlos E.R. wrote:

    On 2026-04-27 10:12, Lawrence D’Oliveiro wrote:
    On Mon, 27 Apr 2026 06:19:09 -0000 (UTC), Lew Pitcher wrote:


    If, for instance, you write a Perl or Python script for
    distribution, it must not, to be useful to the intended audience,
    assume much more than the common components of the selected
    language; a Python 3 script won't be much use on a system that only
    has Python 2 installed, unless it restricts itself to the subset of
    Python 3 syntax and features that are common with Python 2.

    I would not bother maintaining compatibility with any version of
    either Perl or Python that no longer gets official support from
    upstream.

    For example, the last 2.x version of Python lost support over 6 years
    ago. For Python 3, the oldest currently-maintained version is 3.10.
    And going by past schedules, that will likely fall out of support
    sometime around October this year.

    My system still has python 2 installed.

    Scripts that I have seen do not specify versions, but they can.

    #!/usr/bin/env python3

    But they should. The well known planewave program abinit has a python
    script to run the test programs. Unfortunately the hashbang just
    specifies python. Actually the script needs python3. On a system (e.g. OpenSuse) where "python" by default is a symlink to python2, chaos
    ensues, with many obscure error messages till you realize what's
    happening. I have been trying to get the abinitsters to change their
    hashbang, to no avail.
    --
    *********** To reply by e-mail, make w single in address **************
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From rbowman@bowman@montana.com to comp.os.linux.misc on Mon Apr 27 18:06:56 2026
    From Newsgroup: comp.os.linux.misc

    On Mon, 27 Apr 2026 08:12:57 -0000 (UTC), Lawrence D’Oliveiro wrote:

    For example, the last 2.x version of Python lost support over 6 years
    ago.
    For Python 3, the oldest currently-maintained version is 3.10.
    And going by past schedules, that will likely fall out of support
    sometime around October this year.

    On Fedora and Arch /usr/bin/python' is a symlink to python3. You can
    install python2 if you really want to. Ubuntu and its derivatives still
    have /usr/bin/python3. At least the Debian Trixie version for RPi has the python symlink. I haven't updated to Resolute Raccoon yet so that will be interesting.

    More problematic are libraries that haven't caught up with 3.14. The last
    time I tried pyside6 wasn't there yet but pyqt6 was. With 3.15 coming out they will fall even further behind.

    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From rbowman@bowman@montana.com to comp.os.linux.misc on Mon Apr 27 18:08:46 2026
    From Newsgroup: comp.os.linux.misc

    On Mon, 27 Apr 2026 12:42:38 +0200, Carlos E.R. wrote:

    My system still has python 2 installed.

    Scripts that I have seen do not specify versions, but they can.

    Leap 16? Mine doesn't although you need to invoke it with python3 still.
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From rbowman@bowman@montana.com to comp.os.linux.misc on Mon Apr 27 18:11:54 2026
    From Newsgroup: comp.os.linux.misc

    On Mon, 27 Apr 2026 09:43:06 -0700, Ian wrote:

    But they should. The well known planewave program abinit has a python
    script to run the test programs. Unfortunately the hashbang just
    specifies python. Actually the script needs python3. On a system (e.g. OpenSuse) where "python" by default is a symlink to python2, chaos
    ensues,
    with many obscure error messages till you realize what's happening. I
    have been trying to get the abinitsters to change their hashbang, to no avail.

    My install of openSUSE Leap 16 does not have python2 nor is python
    symlinked to python3.
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Richard Kettlewell@invalid@invalid.invalid to comp.os.linux.misc on Mon Apr 27 21:00:07 2026
    From Newsgroup: comp.os.linux.misc

    Lew Pitcher <lew.pitcher@digitalfreehold.ca> writes:
    When writing scripts for distribution, it seems to me to be
    common sense to write those scripts in a manner such that they
    need as little customization as possible. You cannot know all
    the quirks of the environment in which it will run, but you can
    dictate some minimum requirements for the script.

    If, for instance, you write a Perl or Python script for distribution,
    it must not, to be useful to the intended audience, assume much more
    than the common components of the selected language; a Python 3 script
    won't be much use on a system that only has Python 2 installed, unless
    it restricts itself to the subset of Python 3 syntax and features that
    are common with Python 2. Similarly, a bash script won't be of much use
    on a system that only has Korn shell installed, if it uses features
    only available in bash.

    IMO it make more sense to consider scripts to be POSIX shell scripts, or
    Bash scripts, or Korn shell scripts (or zsh etc). They are different
    languages, even if they are very closely related. The same applies to
    Python 2 vs Python 3.

    The runtime support (i.e. the shell executable, the Python install, etc)
    is just another dependency, which might or might not be available on any
    given target; and like any other dependency a software distributor can
    either ship a copy or leave it to the end user to satisfy in whatever
    fashion suits them best.
    --
    https://www.greenend.org.uk/rjk/
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Carlos E.R.@robin_listas@es.invalid to comp.os.linux.misc on Mon Apr 27 23:24:30 2026
    From Newsgroup: comp.os.linux.misc

    On 2026-04-27 18:43, Ian wrote:
    Carlos E.R. wrote:
    On 2026-04-27 10:12, Lawrence D’Oliveiro wrote:
    On Mon, 27 Apr 2026 06:19:09 -0000 (UTC), Lew Pitcher wrote:


    If, for instance, you write a Perl or Python script for
    distribution, it must not, to be useful to the intended audience,
    assume much more than the common components of the selected
    language; a Python 3 script won't be much use on a system that only
    has Python 2 installed, unless it restricts itself to the subset of
    Python 3 syntax and features that are common with Python 2.

    I would not bother maintaining compatibility with any version of
    either Perl or Python that no longer gets official support from
    upstream.

    For example, the last 2.x version of Python lost support over 6 years
    ago. For Python 3, the oldest currently-maintained version is 3.10.
    And going by past schedules, that will likely fall out of support
    sometime around October this year.

    My system still has python 2 installed.

    Scripts that I have seen do not specify versions, but they can.

    #!/usr/bin/env python3

    But they should. The well known planewave program abinit has a python
    script to run the test programs. Unfortunately the hashbang just
    specifies python. Actually the script needs python3. On a system (e.g. OpenSuse) where "python" by default is a symlink to python2, chaos
    ensues, with many obscure error messages till you realize what's
    happening. I have been trying to get the abinitsters to change their hashbang, to no avail.

    I looked at spamassassin.

    I have this:

    Telcontar:~ # python
    python python2-config python3.10 python3.6m
    python-argcomplete-check-easy-install-script python2.7 python3.11 python3.6m-config
    python-argcomplete-check-easy-install-script-3.6 python2.7-config python3.12 pythontex
    python-config python3 python3.6
    python2 python3-config python3.6-config
    Telcontar:~ # which python2
    /usr/bin/python2
    Telcontar:~ # l /usr/bin/python2
    lrwxrwxrwx 1 root root 9 Mar 31 20:52 /usr/bin/python2 -> python2.7* Telcontar:~ #


    The python 2 is real :-D



    Telcontar:~ # which python
    /usr/bin/python
    Telcontar:~ # l /usr/bin/python
    lrwxrwxrwx 1 root root 9 Mar 31 20:52 /usr/bin/python -> python2.7*
    Telcontar:~ #
    --
    Cheers, Carlos.
    ES🇪🇸, EU🇪🇺;
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Carlos E.R.@robin_listas@es.invalid to comp.os.linux.misc on Mon Apr 27 23:36:44 2026
    From Newsgroup: comp.os.linux.misc

    On 2026-04-27 20:08, rbowman wrote:
    On Mon, 27 Apr 2026 12:42:38 +0200, Carlos E.R. wrote:

    My system still has python 2 installed.

    Scripts that I have seen do not specify versions, but they can.

    Leap 16? Mine doesn't although you need to invoke it with python3 still.

    No, 15.6
    --
    Cheers, Carlos.
    ES🇪🇸, EU🇪🇺;
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Lawrence =?iso-8859-13?q?D=FFOliveiro?=@ldo@nz.invalid to comp.os.linux.misc on Mon Apr 27 22:37:21 2026
    From Newsgroup: comp.os.linux.misc

    On Mon, 27 Apr 2026 09:43:06 -0700, Ian wrote:

    Unfortunately the hashbang just specifies python. Actually the
    script needs python3. On a system (e.g. OpenSuse) where "python" by
    default is a symlink to python2, chaos ensues ...

    Yeah, some distros have repurposed “python” as a synonym for
    “python3”, others have not ...
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Lars Poulsen@lars@beagle-ears.com to comp.os.linux.misc on Mon Apr 27 15:56:31 2026
    From Newsgroup: comp.os.linux.misc

    On 2026-04-26 12:18, The Natural Philosopher wrote:
    I am trying to remember when I first used Unix.
    For sure we were coding on a VAX VMS  around 1986, which had Usenet.

    I would bet that if that was so, it was using Eunice from the Wollongong Group. A compatibility layer conceptually similar to Microsoft's WSL1.
    It enabled many unixy features, but installing source code portable
    packages with "autoconf" generating makefiles occasionally gave snarky comments.
    --
    Lars Poulsen - an old geek in Santa Barbara, California
    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From c186282@c186282@nnada.net to comp.os.linux.misc on Mon Apr 27 22:26:23 2026
    From Newsgroup: comp.os.linux.misc

    On 4/27/26 18:37, Lawrence D’Oliveiro wrote:
    On Mon, 27 Apr 2026 09:43:06 -0700, Ian wrote:

    Unfortunately the hashbang just specifies python. Actually the
    script needs python3. On a system (e.g. OpenSuse) where "python" by
    default is a symlink to python2, chaos ensues ...

    Yeah, some distros have repurposed “python” as a synonym for “python3”, others have not ...

    Well, 3 is 3. Anything else is not.

    MOST distros have it set so 'python' evokes python3.

    It's a sleazy fix however.

    Always best to use 'python3' however. It IS possible
    to get/install python2 on a system. Be sure of what
    you're starting - but you'll find out really quick
    anyway.

    --- Synchronet 3.21f-Linux NewsLink 1.2
  • From Marc Haber@mh+usenetspam2616@zugschl.us to comp.os.linux.misc on Tue Apr 28 07:52:08 2026
    From Newsgroup: comp.os.linux.misc

    Lawrence D´Oliveiro <ldo@nz.invalid> wrote:
    On Mon, 27 Apr 2026 09:43:06 -0700, Ian wrote:

    Unfortunately the hashbang just specifies python. Actually the
    script needs python3. On a system (e.g. OpenSuse) where "python" by
    default is a symlink to python2, chaos ensues ...

    Yeah, some distros have repurposed “python” as a synonym for >“python3”, others have not ...

    apt install python-is-python3

    Greetings
    Marc
    -- ---------------------------------------------------------------------------- Marc Haber | " Questions are the | Mailadresse im Header Rhein-Neckar, DE | Beginning of Wisdom " |
    Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fon: *49 6224 1600402
    --- Synchronet 3.21f-Linux NewsLink 1.2