Hi,

I'd like to report an issue with the revision-install target in subversion's
top-level Makefile.in, which is related to the macOS crash discussed in
MacPorts ticket #59712.

https://trac.macports.org/ticket/59712

Problem
-------

When cross-compiling subversion for an x86-64 target on an x86-64 build host
(as done in Yocto/OpenEmbedded), with both 64-bit and 32-bit (multilib) builds
enabled, the revision-install target generates inconsistent content in
svn-revision.txt, causing an RPM file conflict during image assembly.

The target logic is:

    (subversion/svnversion/svnversion $(top_srcdir) 2> /dev/null ||  \
     svnversion $(top_srcdir) 2> /dev/null ||       \
     echo "unknown";     \
    ) > $(DESTDIR)$(includedir)/subversion-1/svn-revision.txt

64-bit build:
  The cross-compiled svnversion binary has the same architecture as the build   host (x86-64). The libtool wrapper script sets LD_LIBRARY_PATH to the build
  directory's .libs, and the host has libapr1 installed. As a result,
  svnversion executes successfully and outputs "Unversioned directory" (since
  the source is a release tarball with no SVN metadata).

32-bit (lib32) build:
  The cross-compiled svnversion is a 32-bit ELF binary. It cannot find the
  32-bit libapr1 on the host, so it fails. The host does not have the
  svnversion tool installed either, so the fallback produces "unknown".

The two packages (subversion-dev and lib32-subversion-dev) both install
/usr/include/subversion-1/svn-revision.txt with different content, causing
an RPM transaction conflict:

    file /usr/include/subversion-1/svn-revision.txt conflicts between
    attempted installs of lib32-subversion-dev and subversion-dev


Root Cause
----------

The revision-install target attempts to run the just-built svnversion binary
during make install. This is unreliable across platforms:

- On macOS, the binary has RPATH pointing to the install location, so it
  crashes if local-install has not completed yet (parallel make), as reported
  in MacPorts #59712.

- On Linux x86-64 cross-compile with multilib, the 64-bit binary happens to
  run successfully while the 32-bit one does not, producing inconsistent
  results.


Proposed Fix
------------

Since the source is always a release tarball with no SVN metadata, the correct
and only meaningful value is "unknown". The svnversion invocations serve no
purpose in this context and should be removed:

    revision-install:
        test -d $(DESTDIR)$(includedir)/subversion-1 || \
          $(MKDIR) $(DESTDIR)$(includedir)/subversion-1
        echo "unknown" > $(DESTDIR)$(includedir)/subversion-1/svn-revision.txt

This is consistent with the "long-term solution" suggested in MacPorts #59712:
remove the unreliable stanza or add proper dependencies between
revision-install and local-install.


Environment
-----------

  Build host:      Ubuntu 24.04, x86-64
  Target:          qemux86-64 (x86-64 with 32-bit multilib)
  Subversion:      1.14.5
  Build system:    Yocto/OpenEmbedded

Thanks,
Haixiao

Reply via email to