commit:     83f41b5d07068d1910d20d3554740971109419d8
Author:     Ian Jordan <immoloism <AT> gmail <DOT> com>
AuthorDate: Sun Jun 16 10:46:09 2024 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Fri Jun 28 09:07:44 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=83f41b5d

dev-libs/libcdio: ModernC fixes

Lack of contact from upstream so adding Parona's patch locally as tested as 
working
fine.

Closes: https://bugs.gentoo.org/918988
Thanks-to: Alfred Wingate <parona <AT> protonmail.com>
Signed-off-by: Ian Jordan <immoloism <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/37184
Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 .../libcdio/files/libcdio-2.1.0-no-lfs-shims.patch | 75 ++++++++++++++++++++++
 ...dio-2.1.0-r1.ebuild => libcdio-2.1.0-r2.ebuild} |  1 +
 2 files changed, 76 insertions(+)

diff --git a/dev-libs/libcdio/files/libcdio-2.1.0-no-lfs-shims.patch 
b/dev-libs/libcdio/files/libcdio-2.1.0-no-lfs-shims.patch
new file mode 100644
index 000000000000..473c54d9b1ee
--- /dev/null
+++ b/dev-libs/libcdio/files/libcdio-2.1.0-no-lfs-shims.patch
@@ -0,0 +1,75 @@
+From https://bugs.gentoo.org/918988
+From: Alfred Wingate <[email protected]>
+Date: Mon, 20 May 2024 22:02:08 +0300
+Subject: [PATCH] Do not use LFS shims, rely on _FILE_OFFSET_BITS=64
+
+See https://savannah.gnu.org/bugs/?65751 and https://bugs.gentoo.org/918988
+
+Setting _FILE_OFFSET_BITS=64 is enough to get the LFS interface,
+using LFS shims is unnecessary on 64-bit systems and they may
+not be available on 32-bit systems on glibc.
+
+Signed-off-by: Alfred Wingate <[email protected]>
+--- a/configure.ac
++++ b/configure.ac
+@@ -547,10 +547,10 @@ AC_DEFINE_UNQUOTED(LIBCDIO_SOURCE_PATH, 
"$LIBCDIO_SOURCE_PATH",
+       [Full path to libcdio top_sourcedir.])
+ AC_SUBST(LIBCDIO_SOURCE_PATH)
+ 
+-AC_CHECK_FUNCS( [chdir drand48 fseeko fseeko64 ftruncate geteuid getgid \
+-               getuid getpwuid gettimeofday lseek64 lstat memcpy memset 
mkstemp rand \
+-               seteuid setegid snprintf setenv strndup unsetenv tzset sleep \
+-               _stati64 usleep vsnprintf readlink realpath gmtime_r 
localtime_r] )
++AC_CHECK_FUNCS( [chdir drand48 fseeko ftruncate geteuid getgid getuid \
++               getpwuid gettimeofday lstat memcpy memset mkstemp rand seteuid 
\
++               setegid snprintf setenv strndup unsetenv tzset sleep _stati64 \
++               usleep vsnprintf readlink realpath gmtime_r localtime_r] )
+ 
+ # check for timegm() support
+ AC_CHECK_FUNC(timegm, AC_DEFINE(HAVE_TIMEGM,1,
+--- a/lib/driver/_cdio_generic.c
++++ b/lib/driver/_cdio_generic.c
+@@ -55,16 +55,6 @@
+ #define PATH_MAX 4096
+ #endif
+ 
+-/* If available and LFS is enabled, try to use lseek64 */
+-#if defined(HAVE_LSEEK64) && defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS 
== 64)
+-#if defined(_MSC_VER)
+-#include <io.h>
+-#endif
+-#define CDIO_LSEEK lseek64
+-#else
+-#define CDIO_LSEEK lseek
+-#endif
+-
+ /*!
+   Eject media -- there's nothing to do here. We always return -2.
+   Should we also free resources?
+@@ -170,7 +160,7 @@ off_t
+ cdio_generic_lseek (void *user_data, off_t offset, int whence)
+ {
+   generic_img_private_t *p_env = user_data;
+-  return CDIO_LSEEK(p_env->fd, offset, whence);
++  return lseek(p_env->fd, offset, whence);
+ }
+ 
+ /*!
+--- a/lib/driver/_cdio_stdio.c
++++ b/lib/driver/_cdio_stdio.c
+@@ -47,11 +47,7 @@
+ #include "_cdio_stdio.h"
+ #include "cdio_assert.h"
+ 
+-/* On 32 bit platforms, fseek can only access streams of 2 GB or less.
+-   Prefer fseeko/fseeko64, that take a 64 bit offset when LFS is enabled */
+-#if defined(HAVE_FSEEKO64) && defined(_FILE_OFFSET_BITS) && 
(_FILE_OFFSET_BITS == 64)
+-#define CDIO_FSEEK fseeko64
+-#elif defined(HAVE_FSEEKO)
++#if defined(HAVE_FSEEKO)
+ #define CDIO_FSEEK fseeko
+ #else
+ #define CDIO_FSEEK fseek
+-- 
+2.45.1
+

diff --git a/dev-libs/libcdio/libcdio-2.1.0-r1.ebuild 
b/dev-libs/libcdio/libcdio-2.1.0-r2.ebuild
similarity index 98%
rename from dev-libs/libcdio/libcdio-2.1.0-r1.ebuild
rename to dev-libs/libcdio/libcdio-2.1.0-r2.ebuild
index 6f2f17a4791e..d3965c51ccec 100644
--- a/dev-libs/libcdio/libcdio-2.1.0-r1.ebuild
+++ b/dev-libs/libcdio/libcdio-2.1.0-r2.ebuild
@@ -39,6 +39,7 @@ MULTILIB_WRAPPED_HEADERS=(
 PATCHES=(
        "${FILESDIR}/${PN}-2.1.0-ncurses_pkgconfig.patch"
        "${FILESDIR}/${P}-realpath-test-fix.patch"
+       "${FILESDIR}/${P}-no-lfs-shims.patch"
 )
 
 src_prepare() {

Reply via email to