bugManeage - Bugs: bug #65677, Conflicting /bin/sh causes crash...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #65677: Conflicting /bin/sh causes crash in high-level sofware

Submitter:  Mohammad Akhlaghi <makhlaghi>
Submitted:  Fri 03 May 2024 11:19:10 AM UTC
   
 
Category:  Software Severity:  3 - Normal
Item Group:  Crash Status:  Ready For Test
Privacy:  Public Assigned to:  makhlaghi
Open/Closed:  Open

Jump to the original submission

Tue 23 Jul 2024 06:12:00 AM UTC, comment #6: 

The equivalent command of "ldd" on macOS is "otool -L". This is what I obtain:

$ otool -L /bin/sh

/bin/sh:
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)


Raul Infante-Sainz <infantesainz>
Group Member
Mon 15 Jul 2024 12:18:12 PM UTC, comment #5: 

Raul: did you get to test the output of the similar command in Comment 1 below in macOS?

On my computer, the outputs look like this (which you can use to compare with the output on macOS):


$ ldd /bin/sh
        linux-vdso.so.1 (0x00007ecaaa3dd000)
        libreadline.so.8 => /usr/lib/libreadline.so.8 (0x00007ecaaa242000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007ecaaa056000)
        libncursesw.so.6 => /usr/lib/libncursesw.so.6 (0x00007ecaa9fe7000)
        /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007ecaaa3df000)

$ ldd /bin/sh \
      | awk '{if($3!="") print $3}' \
      | sed 's#/[^/]*$##' \
      | sort \
      | uniq \
      | awk '{printf "%s:", $1}END{printf "\b"}'
/usr/lib:/usr/lib64


Mohammad Akhlaghi <makhlaghi>
Group administrator
Fri 03 May 2024 07:37:24 PM UTC, comment #4: 

In the previous comment I forgot to mention that I added Commit eabf1354d6 over the branch to fix the first point below about TeXLive.

Mohammad Akhlaghi <makhlaghi>
Group administrator
Fri 03 May 2024 07:36:19 PM UTC, comment #3: 

Two other updates:

  • TeXLive also confronts problem with '/bin/sh' and after a fast look, I couldn't find how the parts in the tarball can be changed: unfortunately we do not build TeXLive packages from sources and things are downloaded, so unfortunately we do not control that part.
  • Bug: On the laptop of Sepideh Eskandarlou (Lenovo P15s) with an ArchLinux that has been similarly updated to my Dell desktop; we noticed that when building "libtoolize", Libtool does not add its necessary internal functions (like 'func_add_hook'). As a result, when Maneage was trying build libpaper, in the 'autoreconf -fi' step, libtoolize would crash with errors of un-known functions. The strange thing is that while the operating systems are almost identical, it happens on one of them! For the time being, I just added '/usr/lib' to 'LD_LIBRARY_PATH' in the Libtool
Mohammad Akhlaghi <makhlaghi>
Group administrator
Fri 03 May 2024 02:55:23 PM UTC, comment #2: 

Two missing shebangs were also corrected in Commit 9e3ea4a5a9 (on the same 'no-bin-sh' branch).

Mohammad Akhlaghi <makhlaghi>
Group administrator
Fri 03 May 2024 11:49:44 AM UTC, comment #1: 

Some extra comments:

  • As mentioned before, I will only actively develop software that are used in the default branch of Maneage (with Gnuastro as the only high-level software). So it would be good if you can check this commit after adding the other software that you commonly build/use.
  • For the edit in Python's source, I fixed it by adding '/usr/lib' to 'LD_LIBRARY_PATH' (also see P.S.). I wonder if this is generic or not? In other words, do all '/bin/sh's link with libraries in '/usr/lib'? I am thinking of adding a check in 'reproduce/software/shell/configure.sh' to read the libraries that '/bin/sh' links to, find their locations and keep them in a variable that is passed to high-level.mk for such cases. For this, I will need help for macOS systems. Raul, can you send me the command to do this on your macOS? The current thing I have in mind on GNU based operating systems is this command. On macOS, probably only the first two 'ldd' and 'awk' need to be modified.



$ ldd /bin/sh \
      | awk '{if($3!="") print $3}' \
      | sed 's#/[^/]*$##' \
      | sort \
      | uniq \
      | awk '{printf "%s:", $1}END{printf "\b"}'


P.S. On the second point: Unfortunately until we build the C library within Maneage, we cannot remove this dependency because Python's 'setup.py' uses 'os.system', which uses C's 'system()' function which will always use '/bin/sh' until we build it ourselves and correct this.

Mohammad Akhlaghi <makhlaghi>
Group administrator
Fri 03 May 2024 11:19:10 AM UTC, original submission:  

Until now, Maneage had a major undetected leak: all low-level software default to '/bin/sh' (which is hard-coded in their sources!). So far this was not noticed because the Maneage shell and the '/bin/sh' of the operating systems we had tested on were compatible. But after trying to re-build a Maneage'd project with 2021 software on a computer with 2024 software, '/bin/sh' (and thus Maneage) crashed!

This lead me into a deep rabbit hole which initially looked bottom-less, but fortunately I finally reached the bottom and was able to fully build that Maneage'd project on that system :-).

The 'no-bin-sh' branch of https://gitlab.com/maneage/project-dev now has the fixes (in particular see Commit 847aa3bbf8d for all the changes so far in one commit; see the commit description and comments in the newly added script for more details on the problem and how it was solved).

I will hopefully be merging this into the main 'maneage' branch in a couple of weeks (along with all the other remaining commits to be merged). In case you have time, it would be good if you can check this build on your operating systems and/or share feedback about this problem/solution.

Mohammad Akhlaghi <makhlaghi>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by infantesainz (Posted a comment)
  • -email is unavailable- added by makhlaghi (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.14-79a4.
    Corresponding source code