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

Remove libinih from codebase and add it as a dependency instead #2443

Merged
merged 3 commits into from
Jan 4, 2023

Conversation

kevinbackhouse
Copy link
Collaborator

@kevinbackhouse kevinbackhouse commented Dec 27, 2022

Fixes: #1811

ini.cpp and ini.hpp are copied from this repo: https://github.com/benhoyt/inih. Most platforms have a libinih-dev library that we can add as a dependency, so we can remove ini.cpp and ini.hpp from the exiv2 codebase.

On most platforms, it is easy to replace ini.cpp and ini.hpp with a dependency, but some platforms only have a libinih library and not a libinih-devel library, which is insufficient for building exiv2. On those platforms, I had to update the Actions workflows to build inih from source. This is the list of platforms where I had to do that:

  1. Centos Stream
  2. MSYS2
  3. Cygwin

On several other platforms, I had to upgrade to a newer version to get a sufficiently recent version of libinih. For example, I upgraded Ubuntu from 20.04 to 22.04.

@codecov
Copy link

codecov bot commented Dec 27, 2022

Codecov Report

Merging #2443 (ba258cb) into main (13ecfbc) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff            @@
##             main    #2443    +/-   ##
========================================
  Coverage   65.43%   65.44%            
========================================
  Files         118      117     -1     
  Lines       21661    21554   -107     
  Branches    10465    10434    -31     
========================================
- Hits        14174    14106    -68     
+ Misses       5296     5266    -30     
+ Partials     2191     2182     -9     
Impacted Files Coverage Δ
src/makernote_int.cpp 66.97% <100.00%> (ø)
src/pngchunk_int.cpp 74.73% <0.00%> (-0.27%) ⬇️
src/pentaxmn_int.cpp 72.34% <0.00%> (ø)
src/pngimage.cpp 62.01% <0.00%> (+0.03%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@kmilos
Copy link
Collaborator

kmilos commented Dec 27, 2022

Et voila for MSYS2: msys2/MINGW-packages#14781

@kevinbackhouse
Copy link
Collaborator Author

Et voila for MSYS2: msys2/MINGW-packages#14781

Wow, that was fast! I was looking into it and only just found that repo about a minute ago!

@kevinbackhouse
Copy link
Collaborator Author

I'll convert this PR to draft until msys2/MINGW-packages#14781 is ready.

The build failure in CIFuzz should resolve itself automatically after this PR is merged, because OSS-Fuzz uses the install script from our main branch: https://github.com/google/oss-fuzz/blob/582e69cebf7a970faf4ffb0c5492e497d860cb12/projects/exiv2/Dockerfile#L19

@kevinbackhouse kevinbackhouse marked this pull request as draft December 27, 2022 15:51
@kmilos
Copy link
Collaborator

kmilos commented Dec 27, 2022

@kevinbackhouse Merged. It might take a couple of hours/days until the binary package actually trickles down to the repo...

@kevinbackhouse kevinbackhouse marked this pull request as ready for review December 28, 2022 15:45
@kevinbackhouse kevinbackhouse added the refactoring Cleanup / Simplify code -> more readable / robust label Dec 28, 2022
@kevinbackhouse kevinbackhouse added this to the v1.00 milestone Dec 28, 2022
@kevinbackhouse
Copy link
Collaborator Author

@piponazo: do these cmake/conan changes look ok to you?

Copy link
Collaborator

@piponazo piponazo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me that libinih is a strong dependency and we should be more strict in checking that the dependency is properly found.

Apart from that, all the changes look good to me 👏

.github/workflows/on_push_BasicWinLinMac.yml Show resolved Hide resolved
cmake/findDependencies.cmake Outdated Show resolved Hide resolved
src/CMakeLists.txt Outdated Show resolved Hide resolved
Copy link
Collaborator

@piponazo piponazo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks ❤️

@kevinbackhouse kevinbackhouse merged commit 346e114 into Exiv2:main Jan 4, 2023
@kevinbackhouse kevinbackhouse deleted the inih-from-library3 branch January 4, 2023 10:44
@kmilos
Copy link
Collaborator

kmilos commented Jan 5, 2023

FWIW: https://cygwin.com/pipermail/cygwin/2023-January/252780.html (couldn't find any other channel for such requests...)

The other option of course is that someone here actually creates a port file and sends it upstream....

@kmilos
Copy link
Collaborator

kmilos commented Jan 5, 2023

There is follow-up re Cygwin: https://cygwin.com/pipermail/cygwin/2023-January/252781.html

Anyone able to test?

@neheb neheb mentioned this pull request Jan 6, 2023
@hassec
Copy link
Member

hassec commented Jan 6, 2023

@kevinbackhouse This seems to have broken the nighlty release build

@kevinbackhouse
Copy link
Collaborator Author

@kevinbackhouse This seems to have broken the nighlty release build

@hassec: sorry about that! I'll look into it.

@eddiezato
Copy link

I build statically with msys2/ucrt64 to get one exe. Now exiv2.exe asks for libINIReader.dll and I can't solve it with -linih or -linireader. Any help, please?

@kmilos
Copy link
Collaborator

kmilos commented Jan 12, 2023

I build statically with msys2/ucrt64 to get one exe. Now exiv2.exe asks for libINIReader.dll

Yep, the MSYS2 package did not ship the static library in the default build options... An update should hit the repo in a couple of hours/days.

Jehan pushed a commit to flathub/org.gimp.GIMP that referenced this pull request Jun 7, 2023
Recently, Exiv2 removed some files from their tree to make it a proper
dependency: Exiv2/exiv2#2443

Though a comment in this MR seems to say it should be a hard dependency,
this other patch says it only disable readExiv2Config() which makes
Exiv2 not read custom user config files: Exiv2/exiv2#2465
(also verified by grepping EXV_ENABLE_INIH which indeed shows it is only
used by this one function)

I assume this is the config file which is discussed of:
https://exiv2.org/manpage.html#config_file

For GIMP, I am unsure if this custom optional config file is that
important and if anyone actually makes use of this. Even more in the
flatpak, where eventually the access to $HOME (where the user file would
be) is meant to disappear for sandboxing reasons. So instead of adding
this additional dep, let's just disable the user config file feature.
Jehan pushed a commit to flathub/org.gimp.GIMP that referenced this pull request Jun 7, 2023
Recently, Exiv2 removed some files from their tree to make it a proper
dependency: Exiv2/exiv2#2443

Though a comment in this MR seems to say it should be a hard dependency,
this other patch says it only disable readExiv2Config() which makes
Exiv2 not read custom user config files: Exiv2/exiv2#2465
(also verified by grepping EXV_ENABLE_INIH which indeed shows it is only
used by this one function)

I assume this is the config file which is discussed of:
https://exiv2.org/manpage.html#config_file

For GIMP, I am unsure if this custom optional config file is that
important and if anyone actually makes use of this. Even more in the
flatpak, where eventually the access to $HOME (where the user file would
be) is meant to disappear for sandboxing reasons. So instead of adding
this additional dep, let's just disable the user config file feature.

(cherry picked from commit 4335a09)
@Ryanf55
Copy link
Contributor

Ryanf55 commented Jul 24, 2023

Just curious, is there a reason the FindInih.cmake doesn't also check inih_inireader_NOTFOUND?

CMake Error in src/CMakeLists.txt:
  Imported target "inih::inireader" includes non-existent path

    "inih_inireader_INCLUDE_DIR-NOTFOUND"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.

On alpine, if you install inih-dev without inih-inireader-dev, you get that error.

@kmilos
Copy link
Collaborator

kmilos commented Jul 24, 2023

On alpine, if you install inih-dev without inih-inireader-dev, you get that error.

Granted, this was not envisaged when I updated the module. I briefly checked the "major" distros - these are usually packaged together... For a such a tiny (few KB) library, splitting is more overhead than benefit IMHO...

@Ryanf55
Copy link
Contributor

Ryanf55 commented Jul 24, 2023

inih_inireader_NOTFOUND

On alpine, they are separate installs. Seems like a quick one-liner could fix it. I'll make a patch.

Ryanf55 added a commit to Ryanf55/exiv2 that referenced this pull request Jul 24, 2023
* Fixes issue on alpine where inih-dev is installed without inih-inireader-dev
* Exiv2#2443 (comment)

Signed-off-by: Ryan Friedman <ryan.friedman+github@avinc.com>
Ryanf55 added a commit to Ryanf55/exiv2 that referenced this pull request Jul 24, 2023
* Fixes issue on alpine where inih-dev is installed without inih-inireader-dev
* Exiv2#2443 (comment)

Signed-off-by: Ryan Friedman <ryan.friedman+github@avinc.com>
neheb pushed a commit that referenced this pull request Jul 24, 2023
* Fixes issue on alpine where inih-dev is installed without inih-inireader-dev
* #2443 (comment)

Signed-off-by: Ryan Friedman <ryan.friedman+github@avinc.com>
mergify bot pushed a commit that referenced this pull request Jul 24, 2023
* Fixes issue on alpine where inih-dev is installed without inih-inireader-dev
* #2443 (comment)

Signed-off-by: Ryan Friedman <ryan.friedman+github@avinc.com>
(cherry picked from commit 16c533f)
neheb pushed a commit that referenced this pull request Jul 24, 2023
* Fixes issue on alpine where inih-dev is installed without inih-inireader-dev
* #2443 (comment)

Signed-off-by: Ryan Friedman <ryan.friedman+github@avinc.com>
(cherry picked from commit 16c533f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Cleanup / Simplify code -> more readable / robust
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider replacing src/ini.cpp with an external library
6 participants