Package: dpkg
Version: 1.23.7

Dear Maintainers,

BACKGROUND

I have a cool script that downloads a .deb file using curl, grovels the
Version out of the beginning of the file, and aborts the download if
it's not a new version. This is useful because Zoom just has a URL
zoom_amd64.deb with no version number until you look inside. The script
is at https://github.com/barak/zoom-ubuntu-repo/blob/master/zoom-up
and the salient bash lines, simplified, are

  touch tmp/zoom
  curl https://zoom.us/client/latest/zoom_amd64.deb >> tmp/zoom &
  ...
  v=$(dpkg --field <(tail --follow --bytes=+0 tmp/zoom) Version)

which gets the new version into $v ASAP so it can be tested and the
download aborted as appropriate.

This used to work fine, but with a new version of dpkg it gets

  dpkg-deb: error: archive '/dev/fd/63' is truncated or corrupt,
expected more data than available (35724 > 0)

ISSUE

What's going on is that the new version of dpkg-deb does a seek on its
file argument, which fails if it's not a real file.  You can see it
here:

  $ dpkg --field /var/cache/apt/archives/task-ssh-server_3.86_all.deb Version
  3.86

  $ dpkg --field <(cat
/var/cache/apt/archives/task-ssh-server_3.86_all.deb) Version
  dpkg-deb: error: archive '/dev/fd/63' is truncated or corrupt,
expected more data than available (608 > 0)

  $ shasum /var/cache/apt/archives/task-ssh-server_3.86_all.deb
  2454b0c8bec4b9f30efc5ef9a28e7dbfc76a3c65
/var/cache/apt/archives/task-ssh-server_3.86_all.deb

  $ shasum <(cat /var/cache/apt/archives/task-ssh-server_3.86_all.deb)
  2454b0c8bec4b9f30efc5ef9a28e7dbfc76a3c65  /dev/fd/63

It would be nice if dpkg-deb would continue to allow a non-seekable
argument, so my lazy pipe stream trick would continue to work.

Cheers,

--Barak.

Reply via email to