Github messages for voidlinux
 help / color / mirror / Atom feed
From: tornaria <tornaria@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] sympow: add a patch to avoid printing warnings
Date: Sun, 14 Nov 2021 15:51:06 +0100	[thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-34077@inbox.vuxu.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 960 bytes --]

There is a new pull request by tornaria against master on the void-packages repository

https://github.com/tornaria/void-packages sympow
https://github.com/void-linux/void-packages/pull/34077

sympow: add a patch to avoid printing warnings
Patch taken from sagemath, without it some sage doctests fail just
because of the extraneous output.

From the patch description:

The default "pkgdatafilesbindir" is something like /var/cache/sympow
that will never be writable by unprivileged users (and cannot safely
be made that way). There is already a fallback to $HOME in the code
that works perfectly well, but by default sympow emits a warning when
it realizes that it can't write to e.g. /var/cache/sympow on the first
try. Since that's completely expected, we hide the warnings behind an
additional level of verbosity (VERBOSE >= 2 instead of VERBOSE >= 1).

A patch file from https://github.com/void-linux/void-packages/pull/34077.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-sympow-34077.patch --]
[-- Type: text/x-diff, Size: 4142 bytes --]

From eb0571f69d9adcbe31405ec956bae7b18a9afa68 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gonzalo=20Tornar=C3=ADa?= <tornaria@cmat.edu.uy>
Date: Sun, 14 Nov 2021 11:13:31 -0300
Subject: [PATCH] sympow: add a patch to avoid printing warnings

Patch taken from sagemath, without it some sage doctests fail just
because of the extraneous output.

From the patch description:

The default "pkgdatafilesbindir" is something like /var/cache/sympow
that will never be writable by unprivileged users (and cannot safely
be made that way). There is already a fallback to $HOME in the code
that works perfectly well, but by default sympow emits a warning when
it realizes that it can't write to e.g. /var/cache/sympow on the first
try. Since that's completely expected, we hide the warnings behind an
additional level of verbosity (VERBOSE >= 2 instead of VERBOSE >= 1).
---
 ...023.6-no-pkgdatafilesbindir-warnings.patch | 45 +++++++++++++++++++
 srcpkgs/sympow/template                       |  2 +-
 2 files changed, 46 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/sympow/patches/sympow-2.023.6-no-pkgdatafilesbindir-warnings.patch

diff --git a/srcpkgs/sympow/patches/sympow-2.023.6-no-pkgdatafilesbindir-warnings.patch b/srcpkgs/sympow/patches/sympow-2.023.6-no-pkgdatafilesbindir-warnings.patch
new file mode 100644
index 000000000000..e3cbe823def7
--- /dev/null
+++ b/srcpkgs/sympow/patches/sympow-2.023.6-no-pkgdatafilesbindir-warnings.patch
@@ -0,0 +1,45 @@
+From cf182287eb4219b03e57352072449885e10543f3 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Fri, 15 May 2020 16:49:49 -0400
+Subject: [PATCH 1/1] main.c: hide pkgdatafilesbindir warnings behind VERBOSE
+ >= 2.
+
+The default "pkgdatafilesbindir" is something like /var/cache/sympow
+that will never be writable by unprivileged users (and cannot safely
+be made that way). There is already a fallback to $HOME in the code
+that works perfectly well, but by default sympow emits a warning when
+it realizes that it can't write to e.g. /var/cache/sympow on the first
+try. Since that's completely expected, we hide the warnings behind an
+additional level of verbosity (VERBOSE >= 2 instead of VERBOSE >= 1).
+---
+ main.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/main.c b/main.c
+index 1d018df..fecd7d1 100644
+--- a/main.c
++++ b/main.c
+@@ -136,17 +136,17 @@ static void prepare_main(char *argv0)
+  asprintf(&pkgdatafilesbindir,"%s/datafiles/"ENDIANTUPLE,pkgcachedir);
+  if (stat(pkgdatafilesbindir,&infodb)) {mode_t mask=umask(0);
+   if (mkdir(pkgdatafilesbindir,(S_IRWXU|S_IRWXG|S_IRWXO|S_ISVTX)))
+-	{if (VERBOSE>=1) fprintf(stderr,"**WARNING** failed to create data bin package cache folder %s\n",pkgdatafilesbindir);
++	{if (VERBOSE>=2) fprintf(stderr,"**WARNING** failed to create data bin package cache folder %s\n",pkgdatafilesbindir);
+    free(pkgdatafilesbindir); pkgdatafilesbindir=NULL;}
+   else
+   {stat(pkgdatafilesbindir,&infodb); pkgdatamode= infodb.st_mode & ~MASK;}
+ 	umask(mask);}
+  else
+  {if (!S_ISDIR(infodb.st_mode))
+-  {if (VERBOSE>=1) fprintf(stderr,"**WARNING** %s exists but is not a directory\n",pkgdatafilesbindir);
++  {if (VERBOSE>=2) fprintf(stderr,"**WARNING** %s exists but is not a directory\n",pkgdatafilesbindir);
+    free(pkgdatafilesbindir); pkgdatafilesbindir=NULL;}
+   else if (access(pkgdatafilesbindir,(R_OK|W_OK|X_OK)))
+-  {if (VERBOSE>=1) fprintf(stderr,"**WARNING** %s yields insufficient permissions\n",pkgdatafilesbindir);
++  {if (VERBOSE>=2) fprintf(stderr,"**WARNING** %s yields insufficient permissions\n",pkgdatafilesbindir);
+    free(pkgdatafilesbindir); pkgdatafilesbindir=NULL;}
+ 	else {pkgdatamode= infodb.st_mode & ~MASK;}}
+  asprintf(&datafilesdir,"%s/datafiles",cachedir);
+-- 
+2.26.2
+
diff --git a/srcpkgs/sympow/template b/srcpkgs/sympow/template
index 0cbf01b30205..d484cf847f57 100644
--- a/srcpkgs/sympow/template
+++ b/srcpkgs/sympow/template
@@ -1,7 +1,7 @@
 # Template file for 'sympow'
 pkgname=sympow
 version=2.023.6
-revision=1
+revision=2
 wrksrc=${pkgname}-v${version}
 build_style=configure
 make_build_target=all

             reply	other threads:[~2021-11-14 14:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-14 14:51 tornaria [this message]
2021-11-15 13:49 ` [PR PATCH] [Merged]: " leahneukirchen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-34077@inbox.vuxu.org \
    --to=tornaria@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).