Skip to content
New issue

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

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

Already on GitHub? # to your account

dpkg cannot install package from relative path #371

Open
naksyl opened this issue Oct 4, 2023 · 2 comments
Open

dpkg cannot install package from relative path #371

naksyl opened this issue Oct 4, 2023 · 2 comments

Comments

@naksyl
Copy link

naksyl commented Oct 4, 2023

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:

  • once or twice relative path worked if deb was not in $PWD (dpkg -i ../*.deb) (dont know how to reproduce)
  • relative paths seems to work when current drive != system drive
rmyorston added a commit that referenced this issue Oct 4, 2023
Commit 548ec70 (win32: interpret absolute paths as relative to
%SYSTEMDRIVE%) introduced the function xabsolute_path() to make
relative paths absolute.  This is used in 'dkpg' and 'man' to
avoid having to tinker with absolute paths from upstream.

Unfortunately, it's too eager to use the relative path.  This
results in dpkg failing to install deb files with a relative path.

Saves 32-48 bytes.

(GitHub issue #371)
@rmyorston
Copy link
Owner

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

@naksyl
Copy link
Author

naksyl commented Oct 7, 2023

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)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants