From 2bc2b430bc4c1a9a0bfd1c01da68bd53bf7da052 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Sun, 10 Sep 2023 03:05:12 +0000 Subject: automatic import of rpm --- ...-wrong-symlink-length-on-some-filesystems.patch | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 backport-bugfix-wrong-symlink-length-on-some-filesystems.patch (limited to 'backport-bugfix-wrong-symlink-length-on-some-filesystems.patch') diff --git a/backport-bugfix-wrong-symlink-length-on-some-filesystems.patch b/backport-bugfix-wrong-symlink-length-on-some-filesystems.patch new file mode 100644 index 0000000..e2052e3 --- /dev/null +++ b/backport-bugfix-wrong-symlink-length-on-some-filesystems.patch @@ -0,0 +1,44 @@ +From 4c301883a5a94a9a186a1bb1d45d234db4db7c88 Mon Sep 17 00:00:00 2001 +From: Dominik Neudert-Schulz +Date: Wed, 30 Jun 2021 14:13:46 +0200 +Subject: [PATCH] fix rpmbuild failure because of wrong symlink length on some + filesystems + +--- + build/files.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/build/files.c b/build/files.c +index f8153ad2b5..571b502e91 100644 +--- a/build/files.c ++++ b/build/files.c +@@ -1363,6 +1363,8 @@ static rpmRC addFile(FileList fl, const char * diskPath, + { + size_t plen = strlen(diskPath); + char buf[plen + 1]; ++ char linkPath[PATH_MAX]; ++ ssize_t linkLen; + const char *cpioPath; + struct stat statbuf; + mode_t fileMode; +@@ -1459,6 +1461,20 @@ static rpmRC addFile(FileList fl, const char * diskPath, + fileUid = statp->st_uid; + fileGid = statp->st_gid; + ++ if (S_ISLNK(fileMode)) { ++ /* stat's man page states that statp->st_size should equal the length of ++ the pointed-to path. On some filesystem a wrong size is reported. ++ So, explicitly get the length here. */ ++ linkLen = readlink(diskPath, linkPath, sizeof(linkPath)); ++ if ((linkLen < 0) || (linkLen >= sizeof(linkPath))) { ++ rpmlog(RPMLOG_ERR, ++ "Symbolic link too long or corrupt: %s\n", ++ diskPath); ++ goto exit; ++ } ++ statp->st_size = linkLen; ++ } ++ + /* Explicit %attr() always wins */ + if (fl->cur.ar.ar_fmodestr) { + if (S_ISLNK(fileMode)) { \ No newline at end of file -- cgit v1.2.3