Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Division by zero on small files (UID too large?) #324

Open
bjackman opened this issue Mar 7, 2024 · 2 comments
Open

Division by zero on small files (UID too large?) #324

bjackman opened this issue Mar 7, 2024 · 2 comments

Comments

@bjackman
Copy link

bjackman commented Mar 7, 2024

Using Makeself version 2.5.0:

/tmp/ms  
❯❯  echo "echo foo" > run.sh

/tmp/ms  
❯❯  chmod +x run.sh 

/tmp/ms  
❯❯  ./run.sh 
foo

/tmp/ms  
❯❯  makeself . run.run "run" "./run.sh"
Header is 714 lines long

About to compress 8 KB of data...
Adding files to archive named "run.run"...
a ./run.shbsdtar: ./run.sh: Numeric user ID too large

CRC: 1837495207
MD5: 7c560c71742f4fa9533dfb1088632ea1

Self-extractable archive "run.run" successfully created.

/tmp/ms  
❯❯  ./run.run 
Verifying archive integrity...     0% expr: division by zero
./run.run: line 137: test: -lt: unary operator expected
 100%   MD5 checksums are OK. All good.
Uncompressing run     0% expr: division by zero
./run.run: line 137: test: -lt: unary operator expected
 100%  
./run.run: line 701: ./run.sh: No such file or directory

I'm not sure if that "Numeric user ID too large" warning is related, it might always have been there - I don't have logs from an older version of makeself to compare unfortunately. My UID is 729974 for what that's worth - I assume this is much bigger than you'd usually encounter on a plain old local Unix system but this is on a fancy work system with PAM magic.

@bjackman
Copy link
Author

bjackman commented Mar 7, 2024

I bisected the "Numeric user ID too large" thing to 64674c7. Kinda seems like it's unrelated to the division by zero.

@bjackman
Copy link
Author

bjackman commented Mar 7, 2024

Hmm OK I tried ignoring the UID thing:

❯❯  git checkout  64674c7
Previous HEAD position was 5742be6 Updated link to release
HEAD is now at 64674c7 add test on Alpine and Nanoserver using busybox (#265)
                                                                                                                                                                                                                                                                                          
~/src/makeself ((64674c74))                                                                                                                                                                                                                                                               
❯❯  make -j clean && make -j                                                                                                                                                                                                                                                              
rm -f makeself-*.run                                                                                                                                                                                                                                                                      
./make-release.sh                                                                                                                                                                                                                                                                         
Header is 716 lines long                                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                          
WARNING: Overwriting existing file: release/makeself-2.4.5.run                                                                                                                                                                                                                            
About to compress 204 KB of data...                                                                                                                                                                                                                                                       
Adding files to archive named "release/makeself-2.4.5.run"...                                                                                                                                                                                                                             
a ./.gitmodulesbsdtar: ./.gitmodules: Numeric user ID too large

a ./COPYINGbsdtar: ./COPYING: Numeric user ID too large

a ./README.mdbsdtar: ./README.md: Numeric user ID too large

a ./VERSIONbsdtar: ./VERSION: Numeric user ID too large

a ./makeself-header.shbsdtar: ./makeself-header.sh: Numeric user ID too large

a ./makeself.1bsdtar: ./makeself.1: Numeric user ID too large

a ./makeself.lsmbsdtar: ./makeself.lsm: Numeric user ID too large

a ./makeself.shbsdtar: ./makeself.sh: Numeric user ID too large

a ./test/appendtestbsdtar: ./test/appendtest: Numeric user ID too large

a ./test/bashunit/.gitbsdtar: ./test/bashunit/.git: Numeric user ID too large

a ./test/bashunit/LICENSEbsdtar: ./test/bashunit/LICENSE: Numeric user ID too large

a ./test/bashunit/README.mdbsdtar: ./test/bashunit/README.md: Numeric user ID too large

a ./test/bashunit/bashunit.bashbsdtar: ./test/bashunit/bashunit.bash: Numeric user ID too large

a ./test/bashunit/test_examplebsdtar: ./test/bashunit/test_example: Numeric user ID too large

a ./test/corrupttestbsdtar: ./test/corrupttest: Numeric user ID too large

a ./test/datetestbsdtar: ./test/datetest: Numeric user ID too large

a ./test/extracttestbsdtar: ./test/extracttest: Numeric user ID too large

a ./test/infotestbsdtar: ./test/infotest: Numeric user ID too large

a ./test/lsmtestbsdtar: ./test/lsmtest: Numeric user ID too large

a ./test/secret_key.gpgbsdtar: ./test/secret_key.gpg: Numeric user ID too large

a ./test/signtestbsdtar: ./test/signtest: Numeric user ID too large

a ./test/suidtestbsdtar: ./test/suidtest: Numeric user ID too large

a ./test/tarextratestbsdtar: ./test/tarextratest: Numeric user ID too large

a ./test/variabletestbsdtar: ./test/variabletest: Numeric user ID too large

a ./test/whitespacelicensetestbsdtar: ./test/whitespacelicensetest: Numeric user ID too large

a ./test/whitespacetestbsdtar: ./test/whitespacetest: Numeric user ID too large

CRC: 3349664934
MD5: b7af1d2485870cd9c4f24c559da617cb

Self-extractable archive "release/makeself-2.4.5.run" successfully created.
~/src/makeself ((64674c74))  
❯❯  mkdir /tmp/tst && cd /tmp/tst

/tmp/tst  
❯❯  ~/src/makeself/release/makeself-2.4.5.run 
Creating directory makeself-2.4.5
Verifying archive integrity...     0% expr: division by zero
/usr/local/google/home/jackmanb/src/makeself/release/makeself-2.4.5.run: line 137: test: -lt: unary operator expected
 100%   MD5 checksums are OK. All good.
Uncompressing Makeself v2.4.5     0% expr: division by zero
/usr/local/google/home/jackmanb/src/makeself/release/makeself-2.4.5.run: line 137: test: -lt: unary operator expected
 100%  
Makeself has extracted itself

/tmp/tst  
❯❯  ls makeself-2.4.5/

So even makeself's own archive doesn't work. Then if I check out the parent commit and try again:

~/src/makeself ((64674c74))  
❯❯  git checkout HEAD^
Previous HEAD position was 64674c7 add test on Alpine and Nanoserver using busybox (#265)
HEAD is now at 5809be7 Update $USER_PWD when using --copy (fixes #262)

~/src/makeself ((5809be74))  
❯❯  make -j clean && make -j
rm -f makeself-*.run
./make-release.sh
Header is 716 lines long

WARNING: Overwriting existing file: release/makeself-2.4.5.run
About to compress 204 KB of data...
Adding files to archive named "release/makeself-2.4.5.run"...
./.gitmodules
./COPYING
./README.md
./VERSION
./makeself-header.sh
./makeself.1
./makeself.lsm
./makeself.sh
./test/appendtest
./test/bashunit/.git
./test/bashunit/LICENSE
./test/bashunit/README.md
./test/bashunit/bashunit.bash
./test/bashunit/test_example
./test/corrupttest
./test/datetest
./test/extracttest
./test/infotest
./test/lsmtest
./test/secret_key.gpg
./test/signtest
./test/suidtest
./test/tarextratest
./test/variabletest
./test/whitespacelicensetest
./test/whitespacetest
CRC: 2974530869
MD5: d486ebaf826466ccb12c6400c6bc62cf

Self-extractable archive "release/makeself-2.4.5.run" successfully created.

~/src/makeself ((5809be74))  
❯❯  rm -rf /tmp/tst; mkdir /tmp/tst && cd /tmp/tst

/tmp/tst  
❯❯  ~/src/makeself/release/makeself-2.4.5.run
Creating directory makeself-2.4.5
Verifying archive integrity...  100%   MD5 checksums are OK. All good.
Uncompressing Makeself v2.4.5  100%  
Makeself has extracted itself

/tmp/tst  
❯❯  ls makeself-2.4.5/
COPYING  makeself.1  makeself-header.sh*  makeself.lsm  makeself.sh*  README.md  test/  VERSION

... it works.

bjackman added a commit to google/page-alloc-bench that referenced this issue Mar 7, 2024
Not sure what's going on but I'm getting issues with Makself, see
megastep/makeself#324.

Haven't really figured out the details so I'm not gonna document this in the
README for now.

My workaround is to checkout commit 5809be74 of makeself, build it (just `make`),
then run the `release/makeself-2.4.5.run` it generates, and use the `makeself.sh`
that I find in its output directory. Not sure why you can't just run the
`makeself-2.4.5.run` directly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant