Bug 32922

Summary: Remove space in shebang
Product: Koha Reporter: Magnus Enger <magnus>
Component: Architecture, internals, and plumbingAssignee: Magnus Enger <magnus>
Status: CLOSED FIXED QA Contact: Martin Renvoize <martin.renvoize>
Severity: trivial    
Priority: P5 - low CC: lucas, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00,22.11.04
Attachments: Bug 32922: Remove space in shebang
Bug 32922: Remove space in shebang
Bug 32922: Remove space in shebang
Bug 32922: Remove space in shebang
Bug 32922: (follow-up) Fix two additional occurences
Bug 29449: Show userid on "Personal details" tab

Description Magnus Enger 2023-02-09 07:51:12 UTC
Some of our scripts have a space in the shebang: 

$ grep -rn --include=*.pl '#! /usr/' *
admin/library_groups.pl:1:#! /usr/bin/perl
admin/credit_types.pl:1:#! /usr/bin/perl
admin/debit_types.pl:1:#! /usr/bin/perl
admin/curbside_pickup.pl:1:#! /usr/bin/perl
admin/desks.pl:1:#! /usr/bin/perl
admin/cities.pl:1:#! /usr/bin/perl
admin/classsources.pl:1:#! /usr/bin/perl
admin/matching-rules.pl:1:#! /usr/bin/perl
admin/background_jobs.pl:1:#! /usr/bin/perl
admin/patron-attr-types.pl:1:#! /usr/bin/perl
circ/curbside_pickups.pl:1:#! /usr/bin/perl
erm/erm.pl:1:#! /usr/bin/perl
misc/cronjobs/delete_items.pl:1:#! /usr/bin/perl
misc/maintenance/check_syspref_cache.pl:1:#! /usr/bin/perl
misc/maintenance/compare_es_to_db.pl:1:#! /usr/bin/perl
misc/add_statistics_borrowers_categorycode.pl:1:#! /usr/bin/perl

It looks like this is not illegal (see e.g. https://unix.stackexchange.com/questions/276751/is-space-allowed-between-and-bin-bash-in-shebang) but it has been argued that we should be consistent (bug 26658) so we might want to fix this. Unless there is some reason for it that I am not aware of?
Comment 1 Magnus Enger 2023-02-09 08:12:52 UTC Comment hidden (obsolete)
Comment 2 Magnus Enger 2023-02-09 08:14:34 UTC
Created attachment 146417 [details] [review]
Bug 32922: Remove space in shebang

Some of our scripts have a space in the "shebang" (first) line:

  #! /usr/bin/perl

This is not illegal, and it does work, but it is good to be
consistent, so this patch removes the space.

To test:
- Run: grep -rn --include=*.pl '#! /usr/' *
- See the list of files that have a space in the shebang
- Apply the patch
- Run the command again, there should be no output, meaning there
  are no more files with space in the shebang
- Have a look at the patch and check that it only changes the
  shebangs
- Sign off
Comment 3 Matt Blenkinsop 2023-02-09 09:27:44 UTC
Created attachment 146419 [details] [review]
Bug 32922: Remove space in shebang

Some of our scripts have a space in the "shebang" (first) line:

  #! /usr/bin/perl

This is not illegal, and it does work, but it is good to be
consistent, so this patch removes the space.

To test:
- Run: grep -rn --include=*.pl '#! /usr/' *
- See the list of files that have a space in the shebang
- Apply the patch
- Run the command again, there should be no output, meaning there
  are no more files with space in the shebang
- Have a look at the patch and check that it only changes the
  shebangs
- Sign off

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 4 Martin Renvoize 2023-02-10 16:46:39 UTC
Created attachment 146498 [details] [review]
Bug 32922: Remove space in shebang

Some of our scripts have a space in the "shebang" (first) line:

  #! /usr/bin/perl

This is not illegal, and it does work, but it is good to be
consistent, so this patch removes the space.

To test:
- Run: grep -rn --include=*.pl '#! /usr/' *
- See the list of files that have a space in the shebang
- Apply the patch
- Run the command again, there should be no output, meaning there
  are no more files with space in the shebang
- Have a look at the patch and check that it only changes the
  shebangs
- Sign off

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Martin Renvoize 2023-02-10 16:46:42 UTC
Created attachment 146499 [details] [review]
Bug 32922: (follow-up) Fix two additional occurences

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 6 Martin Renvoize 2023-02-10 16:49:26 UTC
Oops.. just spotted this was SO'd by Matt.. but I've gone through a QA process on it already.

All working nicely and is a good general consistency improvement.

Passing QA.. Tomas, feel free to push back for an independent QA if you want it .
Comment 7 Tomás Cohen Arazi 2023-02-16 15:02:13 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 8 Magnus Enger 2023-02-23 08:57:37 UTC Comment hidden (obsolete)
Comment 9 Magnus Enger 2023-02-23 08:58:32 UTC Comment hidden (obsolete)
Comment 10 Martin Renvoize 2023-02-24 07:53:00 UTC
Many hands makes light work, thankyou everyone!

Pushed to 22.11.x for the next release
Comment 11 Lucas Gass 2023-03-01 14:06:50 UTC
Does not apply to 22.05.x, no backport.