rmyorston / busybox-w32

WIN32 native port of BusyBox.
https://frippery.org/busybox
Other
693 stars 126 forks source link

`dpkg` cannot install package from relative path #371

Open naksyl opened 1 year ago

naksyl commented 1 year ago

I am working on simple packaging scripts and run into this.

Sript for creating example package (mkdeb):

#!/bin/sh

mkdir -p hello/bin hello/DEBIAN

cat << EOF > hello/bin/hello
#!/bin/sh
echo hello
EOF

cat << EOF > hello/DEBIAN/control
Package: hello
Version: 1.0
Architecture: all
Maintainer: Packaging Team
Description: Hello package example
EOF

echo "2.0" > debian-binary

tar cjf control.tar.bz2 -C hello/DEBIAN .
tar cjf data.tar.bz2 -C hello --exclude DEBIAN .
ar r hello_1.0_all.deb debian-binary control.tar.bz2 data.tar.bz2

Shell session:

~ $ busybox | head -2
BusyBox v1.37.0-FRP-5181-g5c1a3b00e (2023-08-18 12:16:29 BST)
(mingw64-gcc 12.2.1-8.fc38; mingw64-crt 10.0.0-4.fc38; glob)

~ $ ./mkdeb

~ $ dpkg-deb -f hello_1.0_all.deb
Package: hello
Version: 1.0
Architecture: all
Maintainer: Packaging Team
Description: Hello package example

~ $ dpkg -i hello_1.0_all.deb
dpkg: can't open 'hello_1.0_all.deb': No such file or directory

~ $ dpkg -i $(realpath hello_1.0_all.deb)
Preparing to replace hello 1.0 (using C:/Users/naksyl/hello_1.0_all.deb)...
Setting up hello (1.0)...

Notes:

rmyorston commented 1 year ago

Thanks for the report. The issue should be fixed now.

naksyl commented 1 year ago

By mistake I build a broken package without Version control field and got SEGV

dpkg do some control checks as I saw:

$ dpkg -i hello_1.0_all.deb 
dpkg: invalid control file in D:/home/examples/hello_1.0_all.deb
dpkg: no package files specified

but it assumes mandatory fields (Package and Version in case of busybox dpkg) are correct. This is probably an upstream issue (not tested)