commit:     5add06bbc9793015b5139dde6dc07e6575ea9cd1
Author:     Jory A. Pratt <anarchy <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 25 18:52:16 2017 +0000
Commit:     Jory Pratt <anarchy <AT> gentoo <DOT> org>
CommitDate: Tue Jul 25 18:52:16 2017 +0000
URL:        https://gitweb.gentoo.org/proj/musl.git/commit/?id=5add06bb

sys-fs/xfsprogs: Apply upstream patch to fix sdtout definition of
read-only variable

 sys-fs/xfsprogs/Manifest                           |   3 +-
 .../xfsprogs/files/xfsprogs-4.12.0-fix_musl.patch  | 118 +++++++++++++++++++++
 sys-fs/xfsprogs/xfsprogs-4.12.0.ebuild             |   1 +
 3 files changed, 121 insertions(+), 1 deletion(-)

diff --git a/sys-fs/xfsprogs/Manifest b/sys-fs/xfsprogs/Manifest
index 4efd970..d2f8665 100644
--- a/sys-fs/xfsprogs/Manifest
+++ b/sys-fs/xfsprogs/Manifest
@@ -1,4 +1,5 @@
 AUX xfsprogs-4.11.0-musl.patch 1835 SHA256 
1387eebcf9e61ab50fea70e11f7d6873ae47e26f3fba99b8df2d17d6a2db1619 SHA512 
dcfafb16d31c50c6c16ee2a778eda6c946646e129e6c9c96efeb518f7935534dcd7063aded186c5d874ffd07b6eaa31f3ff0e06e0cdca9876565056c727a5494
 WHIRLPOOL 
68b03ec3ccc1258e667e883910dfeaa65945ffdc893da5c752baea1ec6d7c859be85b8287392c951cf60315aee356dd463410d287ff673a2b70dfe9684a56bb9
+AUX xfsprogs-4.12.0-fix_musl.patch 3134 SHA256 
a76aadd93aa62c7f942c2bc5d65db771075a00961ee422e9fd1f3abf67bfab93 SHA512 
90aed5c33bfae13c89ffa26f076bd4c75f6562ec7bd87607238daa0e19e108e7de5f41025880d8314677c31ba54dd9acd4646e44bef139b7256033406427f30e
 WHIRLPOOL 
24e7ffbe1ad68688dabd4be1a1c7af60ea849a73ff78dc80b3a93e0b31bcc8a978da6f6e48bbcd7f1e8de7e37d061b87e4cec2c931c21d42eb8827d97c626df2
 AUX xfsprogs-4.12.0-sharedlibs.patch 2361 SHA256 
4f10b622e8b7c8654a5dc79356343515ef203742ba4781b97a6f02f23e99555a SHA512 
bbf802c54d2c8a2a524a9d4ae0ca66a18bf6b099a00fcc248abee04f84371bd35fc07a2dcc0c1d99c297b474c1f98d92927aa5ca16df5e6caef3abe386f31eba
 WHIRLPOOL 
72e00337e46700ee2a16597bb8188fff229c019c46a39f60598a6d802b8ba094c6e5da8377aad60fee6afd9f491c577d2c84ace3f78a00438268ccbc1832368a
 AUX xfsprogs-4.3.0-cross-compile.patch 5112 SHA256 
5654447555115bce22e443623f6fc17b767681741f043a9dc5e6887967a27db9 SHA512 
2d6303b7c89b3e1ca2ba1d95a4477d0d1c2360ed68bf9c9d3630f990081be98ace9b9c164729635fa582cc5c8bd418e1824e35f613512d43cc6116fcda379582
 WHIRLPOOL 
1fee9f56739d13c1b04b2d0d190b193c97a846902fce8ccba0210cbce6a61bcd2cab118a2c59fb66cd89a957e32e714c3f1dc534697819165a505a8eb8f225b6
 AUX xfsprogs-4.3.0-musl.patch 3543 SHA256 
afe6ea3f95d88abc0b2c276e1c88dd8acc3bdbf10cf93cba54cae9d1de6e1e67 SHA512 
7c86c402bda6630699e63b55389931d8a43c9ed6489c248bf090ca724516c56d4b2b3204dd07272a2e84e11abda8f0aa0735851c3f66330f6be258390a8dafe6
 WHIRLPOOL 
8fb46034afbea1b78c23e931d36920228ee401c0a72b4496eb40771b245c8a0f9800eb8794631362937ad0192fe959c1789fcee5a98d1788035c19219365cce7
@@ -11,6 +12,6 @@ DIST xfsprogs-4.11.0.tar.xz 1113480 SHA256 
c3a6d87b564d7738243c507df82276bed9822
 DIST xfsprogs-4.12.0.tar.xz 1128400 SHA256 
b330ad8d737f4152ae511580102e2fc49212bb51dfb4b614084344abae46d0df SHA512 
1dc4a0a5f40baf1d6398c8f07b4cb3ab796cf052c34b811d60b08c60a4700c2ced8d4d1adb878f8b85ba58cf3e1276db1477109de538fd427d3e359a52f59d4a
 WHIRLPOOL 
c18d3c9dfab8ccb877eb6fa9fa05be3c614a587c6cb616a9f18b52debb8ecacbd22056cb397ff9e69407c66e105d034458b41f0ba4275352f31398e64d303c02
 DIST xfsprogs-4.5.0.tar.gz 1524382 SHA256 
e49beb314984efbd0d758abb5c6137db3bb60a88e59e1e94c00defb536cf89f8 SHA512 
19c95551dc91ec46916f9a7e3d7976907664d32dd5fdc26af0ca62ca74c4b3c10f9e843aac8214ea9d1c0bf140c9f4e321d059808af01a623abedd5067011314
 WHIRLPOOL 
54d742635df024a63181da76c3220671610068363af85be2677521f20342595a5cebb2fd169945572351901ee2c9384f79f54a381ab3620dde22d863aa66d469
 EBUILD xfsprogs-4.11.0.ebuild 2750 SHA256 
de77973986d0e862e0179e74fdd619cf99d54218d282b47324a4dd45c8e86398 SHA512 
7113861301c0e1437133e813a6fb3d1653419d63385f7ba1040953cced4596ac091bc75bee991c82d17b7f4764634a5334a09100f8f9a5b6954154d357d8ee5e
 WHIRLPOOL 
e2c3ea570f178bccf6b0b2bcbb65638af7905931301d87b90ddefa0a469a6c266afec0e5bc370b0dd6a9ee318e376ce270b19fc21ae5687c5f5295101e051d48
-EBUILD xfsprogs-4.12.0.ebuild 2729 SHA256 
9336a0592b2d2642938ba1661c962a14b5ad277b0978846584ad11f0f5a60ac4 SHA512 
f910da3fed6bd41ac3a0d3500f4bc4da7e7644e9864f08a1ad3fe174d1ca79d7f738508145a866f138ef3d370c50414f90d0c2577f3357862fb5a72253b45a78
 WHIRLPOOL 
a8c44865d9c4540541782f8188803f2f374c721e454a33eeee577c83321d84ef8d93f95c51f32faa3cfe6f565cadfb99cdc1b660afb86b4a67f613275be01ced
+EBUILD xfsprogs-4.12.0.ebuild 2772 SHA256 
04ca2d3cd42b3dc50ec559a82780253cc87d3302deaf9c1872c4be7cf698d4d3 SHA512 
ce7afb45c259c606e01de7f916b4663df2ff583635f38159b6dd9136856bc66bf4d4ccca89748665f5541bcf904f7066b5d7677c0292fdd9b54be6172845e7c4
 WHIRLPOOL 
5b8440386b011db2cf71fbdc76bac6faec1766b6ef3dc5c02d37f6a7549531dd7edc6cf8ea6be548ad4f5fec5592d492923ef133064ba556a02f3d36240fc5c7
 EBUILD xfsprogs-4.5.0.ebuild 2936 SHA256 
f4faccf78a63237359239504ba56946817e6c604ebf5836e2c094b0bb1255ff5 SHA512 
7363f71ab6ba657735394682e38cdf4cf21db032c34167435a9d37f74db52f8e25319d172f3d007db2b64973b3bde28abd602b1d64a544122d28654cc3605054
 WHIRLPOOL 
17d12153e5cd04828ac71c41e2e59b32ed21e19af9e0d83f40b93619f800f85ae89f4c272496a7f59268b386e72e97b6a17bb46a370586cda957e3bcadf94616
 MISC metadata.xml 257 SHA256 
c1d4bdabe699c6d9fcdf3b7794a13b45f69e3826b814b422e4ca7e6893b99012 SHA512 
9c7759d33e1bbc8be0da5b4f59fc720266e40f4116d7db0c17c5ad800a7bb638f33a1308e1554092af781f06df6f6cb55db41fc22207cd3edc2e159840e3a3b1
 WHIRLPOOL 
4afcbc79dd61237c778735b39060b3e294fdc07da5b0da6f7b40db92649ac71febddd7a0265502e102d8eec9664fd5af2071fff9428bfcb0a6bf06cf70c68a3d

diff --git a/sys-fs/xfsprogs/files/xfsprogs-4.12.0-fix_musl.patch 
b/sys-fs/xfsprogs/files/xfsprogs-4.12.0-fix_musl.patch
new file mode 100644
index 0000000..de647d9
--- /dev/null
+++ b/sys-fs/xfsprogs/files/xfsprogs-4.12.0-fix_musl.patch
@@ -0,0 +1,118 @@
+From 21253610f9ef87db8e2a75b863b7fcfbd0cdb421 Mon Sep 17 00:00:00 2001
+From: "Darrick J. Wong" <[email protected]>
+Date: Tue, 25 Jul 2017 13:45:01 -0500
+Subject: [PATCH] In patch 4944defad4 ("xfs_db: redirect printfs when
+ metadumping to stdout"), we solved the problem of xfs_db printfs ending up in
+ the metadump stream by reassigning stdout for the duration of a stdout
+ metadump.  Unfortunately, musl doesn't allow stdout to be reassigned (in
+ their view "extern FILE *stdout" means "extern FILE * const stdout"), so we
+ abandon the old approach in favor of playing games with dup() to switch the
+ raw file descriptors.
+
+While we're at it, fix a regression where an unconverted outf test
+allows progress info to end up in the metadump stream.
+
+Signed-off-by: Darrick J. Wong <[email protected]>
+---
+ db/metadump.c | 47 ++++++++++++++++++++++++++++++++++++-----------
+ 1 file changed, 36 insertions(+), 11 deletions(-)
+
+diff --git a/db/metadump.c b/db/metadump.c
+index 96641e0..4e2f648 100644
+--- a/db/metadump.c
++++ b/db/metadump.c
+@@ -78,6 +78,7 @@ static int           obfuscate = 1;
+ static int            zero_stale_data = 1;
+ static int            show_warnings = 0;
+ static int            progress_since_warning = 0;
++static bool           stdout_metadump;
+ 
+ void
+ metadump_init(void)
+@@ -137,7 +138,7 @@ print_progress(const char *fmt, ...)
+       va_end(ap);
+       buf[sizeof(buf)-1] = '\0';
+ 
+-      f = (outf == stdout) ? stderr : stdout;
++      f = stdout_metadump ? stderr : stdout;
+       fprintf(f, "\r%-59s", buf);
+       fflush(f);
+       progress_since_warning = 1;
+@@ -2750,7 +2751,8 @@ metadump_f(
+       xfs_agnumber_t  agno;
+       int             c;
+       int             start_iocur_sp;
+-      bool            stdout_metadump = false;
++      int             outfd = -1;
++      int             ret;
+       char            *p;
+ 
+       exitcode = 1;
+@@ -2870,16 +2872,35 @@ metadump_f(
+                * metadump operation so that dbprintf and other messages
+                * are sent to the console instead of polluting the
+                * metadump stream.
++               *
++               * We get to do this the hard way because musl doesn't
++               * allow reassignment of stdout.
+                */
+-              outf = stdout;
+-              stdout = stderr;
++              fflush(stdout);
++              outfd = dup(STDOUT_FILENO);
++              if (outfd < 0) {
++                      perror("opening dump stream");
++                      goto out;
++              }
++              ret = dup2(STDERR_FILENO, STDOUT_FILENO);
++              if (ret < 0) {
++                      perror("redirecting stdout");
++                      close(outfd);
++                      goto out;
++              }
++              outf = fdopen(outfd, "a");
++              if (outf == NULL) {
++                      fprintf(stderr, "cannot create dump stream\n");
++                      dup2(outfd, 1);
++                      close(outfd);
++                      goto out;
++              }
+               stdout_metadump = true;
+       } else {
+               outf = fopen(argv[optind], "wb");
+               if (outf == NULL) {
+                       print_warning("cannot create dump file");
+-                      free(metablock);
+-                      return 0;
++                      goto out;
+               }
+       }
+ 
+@@ -2907,15 +2928,19 @@ metadump_f(
+       if (progress_since_warning)
+               fputc('\n', stdout_metadump ? stderr : stdout);
+ 
+-      if (stdout_metadump)
+-              stdout = outf;
+-      else
+-              fclose(outf);
++      if (stdout_metadump) {
++              fflush(outf);
++              fflush(stdout);
++              ret = dup2(outfd, STDOUT_FILENO);
++              if (ret < 0)
++                      perror("un-redirecting stdout");
++      }
++      fclose(outf);
+ 
+       /* cleanup iocur stack */
+       while (iocur_sp > start_iocur_sp)
+               pop_cur();
+-
++out:
+       free(metablock);
+ 
+       return 0;
+-- 
+2.13.3
+

diff --git a/sys-fs/xfsprogs/xfsprogs-4.12.0.ebuild 
b/sys-fs/xfsprogs/xfsprogs-4.12.0.ebuild
index 772f842..730f86c 100644
--- a/sys-fs/xfsprogs/xfsprogs-4.12.0.ebuild
+++ b/sys-fs/xfsprogs/xfsprogs-4.12.0.ebuild
@@ -32,6 +32,7 @@ PATCHES=(
        "${FILESDIR}"/${PN}-4.7.0-libxcmd-link.patch
        "${FILESDIR}"/${PN}-4.9.0-underlinking.patch
        "${FILESDIR}"/${PN}-4.11.0-musl.patch
+       "${FILESDIR}"/${PN}-4.12.0-fix_musl.patch
 )
 
 pkg_setup() {

Reply via email to