diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-09-10 03:05:12 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-09-10 03:05:12 +0000 |
| commit | 2bc2b430bc4c1a9a0bfd1c01da68bd53bf7da052 (patch) | |
| tree | a2af4fd609c7decacbf0ea11926ea338596fb179 /backport-bugfix-wrong-symlink-length-on-some-filesystems.patch | |
| parent | 0ae9f87336a3d78d8fbc0a1e5c75cba5f9cf8597 (diff) | |
automatic import of rpm
Diffstat (limited to 'backport-bugfix-wrong-symlink-length-on-some-filesystems.patch')
| -rw-r--r-- | backport-bugfix-wrong-symlink-length-on-some-filesystems.patch | 44 |
1 files changed, 44 insertions, 0 deletions
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 <dominikns@bachtechnology.com> +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 |
