imageinfo fails in Ubuntu 23.04 with a "no such file or directory" error

Bug #2012119 reported by Rocko
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
imageinfo (Ubuntu)
Triaged
Undecided
Unassigned

Bug Description

imageinfo fails in Ubuntu 23.04 with a "no such file or directory" error, eg:

$ imageinfo --size /usr/share/backgrounds/Lunar-lobster-side_by_Gixo-dark.png
imageinfo: unable to open image `��s��U': No such file or directory @ error/blob.c/OpenBlob/2924.

$ imageinfo --size /usr/share/backgrounds/Copper_Mountain_by_Eduardo_Battaglia.jpg
imageinfo: unable to open image `�=�V': No such file or directory @ error/blob.c/OpenBlob/2924.

The filename it complains is not found seems to be random and changes each time. Under WSL, it fails but just says "unable to open image `': No such file", ie it doesn't show the random text.

ProblemType: Bug
DistroRelease: Ubuntu 23.04
Package: imageinfo 0.04-0ubuntu12
ProcVersionSignature: Ubuntu 6.1.0-16.16-generic 6.1.6
Uname: Linux 6.1.0-16-generic x86_64
ApportVersion: 2.26.0-0ubuntu2
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: ubuntu:GNOME
Date: Sat Mar 18 16:31:02 2023
InstallationDate: Installed on 2021-09-28 (536 days ago)
InstallationMedia: Ubuntu 21.10 "Impish Indri" - Beta amd64 (20210924)
ProcEnviron:
 LANG=en_US.UTF-8
 PATH=(custom, no user)
 SHELL=/bin/bash
 TERM=xterm-256color
 XDG_RUNTIME_DIR=<set>
SourcePackage: imageinfo
UpgradeStatus: Upgraded to lunar on 2023-03-16 (1 days ago)

Revision history for this message
Rocko (rockorequin) wrote :
Revision history for this message
Rocko (rockorequin) wrote :

I tried to build imageinfo from source (using apt source imageinfo) but after installing the build-deps (sudo apt build-dep imageinfo) and also the extra package required for Magick-config so configure will succeed, it fails to build with the error "imageinfo.c:373:15: error: ‘Image’ has no member named ‘color_profile’":

$ make
gcc -c imageinfo.c -g -O2 -Wall -DARCH_IS_BIG_ENDIAN=0 -DIMINVERSION=\"0.04\" @MAGICK_CFLAGS@
imageinfo.c: In function ‘main’:
imageinfo.c:99:9: warning: variable ‘orientswitch’ set but not used [-Wunused-but-set-variable]
   99 | float orientswitch = 5.0;
      | ^~~~~~~~~~~~
imageinfo.c: In function ‘signature’:
imageinfo.c:239:9: warning: ‘GetIndexes’ is deprecated [-Wdeprecated-declarations]
  239 | ip = GetIndexes(image);
      | ^~
In file included from /usr/include/magick/enum_strings.h:23,
                 from /usr/include/magick/api.h:84,
                 from imageinfo.c:27:
/usr/include/magick/pixel_cache.h:105:4: note: declared here
  105 | *GetIndexes(const Image *image)
      | ^~~~~~~~~~
imageinfo.c: In function ‘piccmd5’:
imageinfo.c:373:15: error: ‘Image’ has no member named ‘color_profile’
  373 | pi = &(image->color_profile);
      | ^~
make: *** [Makefile:57: imageinfo.o] Error 1

Revision history for this message
Rocko (rockorequin) wrote :

The problem is actually in libpopt. Installing the package from Ubuntu 22.10 (libpopt0_1.18-3build1_amd64.deb, https://packages.ubuntu.com/kinetic/amd64/libpopt0/download) fixes the problem.

Revision history for this message
Rocko (rockorequin) wrote :

Downgrading popt from 1.19+dfsg-1 to 1.18-3build1 shows that the problem is not in imageinfo but in popt.

affects: imageinfo (Ubuntu) → popt (Ubuntu)
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thank you for taking the time to file a bug report.

I did some investigation and noticed that the problem is actually with imageinfo.

From imageinfo.c:

  filename = poptGetArg(poptctxt);
  if (poptGetArg(poptctxt) != NULL) {
    fprintf(stderr, "imageinfo: must specify a single filename\n");
    poptFreeContext(poptctxt);
    exit(2);
  }
  poptFreeContext(poptctxt);
  if (!filename) {
    fprintf(stderr, "imageinfo: must specify a filename\n");
    exit(3);
  }

This excerpt is saving a pointer to the the "filename" string that's found inside "poptctxt", but then it calls "poptFreeContext", which will invoke "free" on that same string.

affects: popt (Ubuntu) → imageinfo (Ubuntu)
Changed in imageinfo (Ubuntu):
status: New → Triaged
Revision history for this message
Rocko (rockorequin) wrote (last edit ):

Is this likely to be fixed before 23.04 comes out? I'd patch it myself, but as I mentioned, the source from the repos fails to build (with the error ‘Image’ has no member named ‘color_profile’).

Below is what I did. Am I doing something wrong?

apt source imageinfo
sudo apt build-dep imageinfo
sudo apt install graphicsmagick-libmagick-dev-compat # Need this as well as the build-deps

cd imageinfo-0.04
./configure
make

...

imageinfo.c: In function ‘piccmd5’:
imageinfo.c:373:15: error: ‘Image’ has no member named ‘color_profile’
  373 | pi = &(image->color_profile);
      | ^~
make: *** [Makefile:57: imageinfo.o] Error 1

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.