[PATCH v2] fstools: blockd Check /tmp/run/blockd for existing mounts

2021-06-13 Thread David Adair via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---
Currently volume names can not match rootfs files/directories
so LV names like "home" "usr" or "www" are not allowed.

This changes the check for existing mount points to
examine /tmp/run/blockd/ instead of /.

It also checks that a link is present at
/mnt/ and skips the request if it is missing
e.g. the "map" does not support the requested "key".

This aligns the mount logic to match the automount
daemon indirect.c logic from kernel.org.
 - If mountpoint exist and is not a zombie return success.
 - If mountpoint is a zombie delete it.
 - If map is missing or mount fails return failure.

This greatly simplifies hotplug-remove since we leave
devices alone once link is removed.  It also fixes most
instances of poision directories remaining in automount
dir and causing "too many symlinks" errors.

Signed-off-by: David Adair 
---
 blockd.c | 25 ++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/blockd.c b/blockd.c
index d6dfeb8..6024c60 100644
--- a/blockd.c
+++ b/blockd.c
@@ -41,6 +41,7 @@ struct device {
 
 static struct uloop_fd fd_autofs_read;
 static int fd_autofs_write = 0;
+static struct stat autofs_mp_stat;
 static struct ubus_auto_conn conn;
 struct blob_buf bb = { 0 };
 
@@ -501,8 +502,10 @@ static void autofs_read_handler(struct uloop_fd *u, 
unsigned int events)
 {
union autofs_v5_packet_union pktu;
const struct autofs_v5_packet *pkt;
-   int cmd = AUTOFS_IOC_READY;
struct stat st;
+   struct device *device;
+   char *mnt;
+   int cmd = AUTOFS_IOC_READY;
 
while (read(u->fd, , sizeof(pktu)) == -1) {
if (errno != EINTR)
@@ -517,9 +520,24 @@ static void autofs_read_handler(struct uloop_fd *u, 
unsigned int events)
 
pkt = _indirect;
 ULOG_ERR("kernel is requesting a mount -> %s\n", pkt->name);
-   if (lstat(pkt->name, ) == -1)
-   if (block("autofs", "add", (char *)pkt->name))
+   /*
+* if MP exists send "ready"
+*   second part of check detects zombie mounts --
+*   valid target should have target dev not autofs.
+*/
+   if (asprintf(, "%s%s", AUTOFS_MOUNT_PATH, pkt->name) == -1)
+   exit(ENOMEM);
+   if ((lstat(mnt, ) == -1) ||
+   (S_ISDIR(st.st_mode) && st.st_dev == autofs_mp_stat.st_dev)) {
+   rmdir(mnt);
+   device = vlist_find(, pkt->name, device, node);
+   /* Map doesn't exist or mount fails send "fail" */
+   if (!device || !device->target ||
+   lstat(device->target, ) || ! S_ISLNK(st.st_mode) ||
+   block("autofs", "add", (char *)pkt->name))
cmd = AUTOFS_IOC_FAIL;
+   }
+   free(mnt);
 
if (ioctl(fd_autofs_write, cmd, pkt->wait_queue_token) < 0)
ULOG_ERR("failed to report back to kernel\n");
@@ -562,6 +580,7 @@ static int autofs_mount(void)
return -1;
}
close(pipefd[1]);
+   stat(AUTOFS_MOUNT_PATH, _mp_stat);
fd_autofs_read.fd = pipefd[0];
fd_autofs_read.cb = autofs_read_handler;
uloop_fd_add(_autofs_read, ULOOP_READ);
-- 
2.27.0




--- End Message ---
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: Re: [PATCH] fstools: blockd Check /tmp/run/blockd for existing mounts

2021-06-13 Thread David Adair via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---
+   sprintf(mnt, "/mnt/%s", pkt->name);

This was incorrect.  Blockd supports arbitrary mount points so need to use 
device->target.


--- End Message ---
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] fstools: blockd Check /tmp/run/blockd for existing mounts

2021-06-07 Thread David Adair via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---

Currently volume names can not match rootfs files/directories
so names like "home" "usr" or "www" are not allowed.

This changes the check for existing mount points to
examine /tmp/run/blockd/ instead of /.

It also checks that a link is present at
/mnt/ and skips the request if it is missing
e.g. the "map" does not support the requested "key".

This aligns the mount logic to match the automount
daemon indirect.c logic from kernel.org.
 - If mountpoint exist and is not a zombie return success.
 - If mountpoint is a zombie delete it.
 - If map is missing or mount fails return failure.

This greatly simplifies hotplug-remove since we leave
devices alone once link is removed.  It also fixes most
instances of poision directories remaining in automount
dir and causing "too many symlinks" errors.

Signed-off-by: David Adair 
---
 blockd.c | 23 ---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/blockd.c b/blockd.c
index d6dfeb8..eacea27 100644
--- a/blockd.c
+++ b/blockd.c
@@ -41,6 +41,7 @@ struct device {
 
 static struct uloop_fd fd_autofs_read;
 static int fd_autofs_write = 0;
+static struct stat autofs_mp_stat;
 static struct ubus_auto_conn conn;
 struct blob_buf bb = { 0 };
 
@@ -503,6 +504,7 @@ static void autofs_read_handler(struct uloop_fd *u, 
unsigned int
events)
const struct autofs_v5_packet *pkt;
int cmd = AUTOFS_IOC_READY;
struct stat st;
+   char *mnt;
 
while (read(u->fd, , sizeof(pktu)) == -1) {
if (errno != EINTR)
@@ -517,9 +519,23 @@ static void autofs_read_handler(struct uloop_fd *u, 
unsigned int
events)
 
pkt = _indirect;
 ULOG_ERR("kernel is requesting a mount -> %s\n", pkt->name);
-   if (lstat(pkt->name, ) == -1)
-   if (block("autofs", "add", (char *)pkt->name))
-   cmd = AUTOFS_IOC_FAIL;
+   /*
+* if MP exists send "ready"
+*   second part of check detects zombie mounts --
+*   valid target should have target dev.
+*/
+   if (asprintf(, "%s%s", AUTOFS_MOUNT_PATH, pkt->name) == -1)
+   exit(ENOMEM);
+   if ((lstat(mnt, ) == -1) ||
+   (S_ISDIR(st.st_mode) && st.st_dev == autofs_mp_stat.st_dev)) {
+   rmdir(mnt);
+   sprintf(mnt, "/mnt/%s", pkt->name);
+   /* Map doesn't exist or mount fails send "fail" */
+   if (lstat(mnt, ) || ! S_ISLNK(st.st_mode) ||
+   block("autofs", "add", (char *)pkt->name))
+   cmd = AUTOFS_IOC_FAIL;
+   }
+   free(mnt);
 
if (ioctl(fd_autofs_write, cmd, pkt->wait_queue_token) < 0)
ULOG_ERR("failed to report back to kernel\n");
@@ -562,6 +578,7 @@ static int autofs_mount(void)
return -1;
}
close(pipefd[1]);
+   stat(AUTOFS_MOUNT_PATH, _mp_stat);
fd_autofs_read.fd = pipefd[0];
fd_autofs_read.cb = autofs_read_handler;
uloop_fd_add(_autofs_read, ULOOP_READ);
-- 
2.27.0




--- End Message ---
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: Re: Does blockd intentionally skip mounts if device name exists in / ?

2021-06-07 Thread David Adair via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---
Since no one answered, I suggest that the original intent was to follow
the logic from the kernel.org autofs daemon sample aka automount.  The
existing code is very close but lacks a couple bits.

Neither of my suggestions accomplished this intent so I will provide a patch
that does shortly but did not want to clutter it up with gory detail.

In indirect.c ( blockd uses indirect maps so this is the best comparision )
we have (with pthread stuff removed)

len = ncat_path(buf, sizeof(buf), ap->path, mt.name, mt.len);
if (!len) {
< not interesting error goop >
}

status = lstat(buf, );
if (status != -1 && !(S_ISDIR(st.st_mode) && st.st_dev == mt.dev)) {
error(ap->logopt,
  "indirect trigger not valid or already mounted %s", buf);
ops->send_ready(ap->logopt, ap->ioctlfd, mt.wait_queue_token);

}

info(ap->logopt, "attempting to mount entry %s", buf);

set_tsd_user_vars(ap->logopt, mt.uid, mt.gid);
status = lookup_nss_mount(ap, NULL, mt.name, mt.len);
if (status) {
ops->send_ready(ap->logopt,
ap->ioctlfd, mt.wait_queue_token);

info(ap->logopt, "mounted %s", buf);
} else {
/* TODO: get mount return status from lookup_nss_mount */
ops->send_fail(ap->logopt,
   ap->ioctlfd, mt.wait_queue_token, -ENOENT);
info(ap->logopt, "failed to mount %s", buf);
}


For blockd the existence of the soft-link in /mnt is equivalent to the
lookup request with nss/cache operation so this would translate to:

 - if dir exists in /tmp/run/blockd and IS NOT a leftover zombie with
   device == /tmp/run/blockd device. Then do nothing and report success.

 - remove dir if it exists.

 - if link is present in /mnt and block mount succeeds report success.

 - otherwise report failure.

Recent autofs v5 docs (filesystems/autofs.rst) make a big deal about errors
caused by pgid != automount messing with the mount points.
Too many levels of symbolic links
My assuption is that the second part of the test which fixes these
"poison" directories:
!(S_ISDIR(st.st_mode) && st.st_dev == mt.dev)
was not included because it did not exist when the code was written.

As far as the missing "ncat_path" my guess is that was either overlooked
or some earlier kernel abi provided the full path.

Using the logic from automount is working much nicer:
  - No more "suprise" illegal volume names.
  - Hotplug-out actually stops mount requests when link is removed instead
of having mount re-appear just as we are trying to lvchange -an.
  - System gracefully and automatically recovers from user-initiated umounts.





--- End Message ---
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Does blockd intentionally skip mounts if device name exists in / ?

2021-06-03 Thread David Adair via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---
This will block autofs from mounting volumes with names like "home" or "usr" -- 
was that
actually the intent ?

root@OpenWrt:/# touch /cv
root@OpenWrt:/# ls /mnt/cv
ls: /mnt/cv: No such file or directory
root@OpenWrt:/# rm /cv
root@OpenWrt:/# ls /mnt/cv
[  205.014819] EXT4-fs (dm-3): mounted filesystem with ordered data mode. Opts: 
hi  keepme  lost+found  tt

root@OpenWrt:~# cat /proc/2520/cmdline && echo -n " " && ls -l /proc/2520/cwd
/sbin/blockd lrwxrwxrwx1 root root 0 Jun  3 00:01 
/proc/2520/cwd -> /

Blockd does not forward mount request to block because of the lstat:

ULOG_ERR("kernel is requesting a mount -> %s\n", pkt->name);
if (lstat(pkt->name, ) == -1)
if (block("autofs", "add", (char *)pkt->name))
cmd = AUTOFS_IOC_FAIL;

It seems like the intention was to check either /mnt or /tmp/run/blockd instead 
of / .
Since /mnt contains symlinks for mounts with the "autofs" property and 
directories
for anon mounts it seems to make sense but lstat will only work in 
/tmp/run/blockd.

Perhaps:
ULOG_ERR("kernel is requesting a mount -> %s\n", pkt->name);
if (asprintf(, "/mnt/%s", pkt->name) == -1)
exit(ENOMEM);
if (stat(mnt, ) == -1)
if (block("autofs", "add", (char *)pkt->name))
cmd = AUTOFS_IOC_FAIL;
free(mnt);

Or:  ( haven't tested this one )
ULOG_ERR("kernel is requesting a mount -> %s\n", pkt->name);
if (asprintf(, "/mnt/%s", pkt->name) == -1)
exit(ENOMEM);
if (!lstat(pkt->name, ) && S_ISLNK(st.st_mode))
if (block("autofs", "add", (char *)pkt->name))
cmd = AUTOFS_IOC_FAIL;
free(mnt);

Or just no test at all since there has effectively been no test for years.



--- End Message ---
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: Re: [PATCH 2/3] menuconfig: Add CONFIG_BUILD_DOCUMENTATION

2021-05-22 Thread David Adair via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---
> Do you use the docs generated by OpenWrt packages? If not, I would only
> take the first patch to deactivate building docs for ccache.

No I don't use the generated docs but wasn't sure about others.
Just the first patch would be great for master.

Thanks.



--- End Message ---
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: Re: [Q] [master][openwrt-21.02] Check on 'which' in include/prereq-build.mk fails for Fedora 34 since recently, how to fix?

2021-05-14 Thread David Adair via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---
Barely a hint but I think the issue is related to
-_shell="$(basename $SHELL)"
+which_shell="$(cat /proc/$$/comm)"

Interacting with
SHELL:=sh

Seems like SetupHostCommand wants to find an actual command
which works for sh but not the other shells.

$ which which | grep which
alias which='(alias; declare -f) | /usr/bin/which --tty-only --read-alias 
--read-functions 
--show-tilde --show-dot'
/usr/bin/which

$ sh -c "which which | grep which"
/usr/bin/which

Perhaps one or more of these as alternative commands to try if the first fails ?
which --skip-alias --skip-functions which | grep which
${SHELL} -c "which which | grep which"
which which | grep which | grep -v alias
which which | grep which | tail -1

e.g.
$(eval $(call SetupHostCommand,which,Please install 'which', \
which which | grep which, \
which --skip-alias --skip-functions which | grep which))


Not so sure though since there are several other uses of "which" in prereq.mk.
It would be safer if you could find a way to stop your system from using the 
alias.




--- End Message ---
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH 3/3] ccache: Add 030-make-documentation-optional.patch

2021-05-14 Thread David Adair via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---

Added patch 030-make-documentation-optional.patch to include upstream
commit: b96ca763c453a602 which allows us to avoid the build failures
due to non-ascii characters in the documentation.  Since we don't need
docs anyway it is easier to just build with -D ENABLE_DOCUMENTATION=OFF
rather than attempt to fix the docs which break from time to time.

This patch is only required for the 21.02 branch since other branches
do not have the non-ascii character build failures at this time.  By the
time they *did* have a problem they would also include this change.

Note: patch itself is not my work it is:
Signed-off-by: Petr Štetiar 

Signed-off-by: David Adair 
---
 .../030-make-documentation-optional.patch | 37 +++
 1 file changed, 37 insertions(+)
 create mode 100644 tools/ccache/patches/030-make-documentation-optional.patch

diff --git a/tools/ccache/patches/030-make-documentation-optional.patch
b/tools/ccache/patches/030-make-documentation-optional.patch
new file mode 100644
index 00..ccd25067cb
--- /dev/null
+++ b/tools/ccache/patches/030-make-documentation-optional.patch
@@ -0,0 +1,37 @@
+From b96ca763c453a602b5516b4b9ca5e2829528e318 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20=C5=A0tetiar?= 
+Date: Mon, 3 May 2021 18:44:53 +0200
+Subject: [PATCH] CMake: make build of documentation optional (#842)
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+So we don't need to support corner cases as for example one fixed in
+commit f6202db308e3 ("doc/MANUAL.adoc: Don't use non-ASCII quotes
+(#761)") when the documentation is actually not needed at all as ccache
+is used as a build tool only.
+
+Signed-off-by: Petr Štetiar 
+---
+ CMakeLists.txt | 5 -
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 0825f2af..e186e812 100644
+--- a/CMakeLists.txt
 b/CMakeLists.txt
+@@ -133,7 +133,10 @@ target_link_libraries(ccache PRIVATE standard_settings
standard_warnings ccache_
+ #
+ # Documentation
+ #
+-add_subdirectory(doc)
++option(ENABLE_DOCUMENTATION "Enable documentation" ON)
++if(ENABLE_DOCUMENTATION)
++  add_subdirectory(doc)
++endif()
+ 
+ #
+ # Installation
+-- 
+2.27.0
+
-- 
2.27.0




--- End Message ---
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH 2/3] menuconfig: Add CONFIG_BUILD_DOCUMENTATION

2021-05-14 Thread David Adair via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---

This provides a way to override the ccache ENABLE_DOCUMENTATION=OFF
setting and restore previous behavior.  It is optional since the
default required to disable the doc build (and avoid the non-ascii
character build failures) is !="y".

It could potentially be useful:
 - If we want the default to be "y"
 - To supress docs on other packages. Would be most useful for the
   autoconf based tools but I could not figure out an easy way to
   accomplish that.

Signed-off-by: David Adair 
---
 config/Config-build.in | 9 +
 1 file changed, 9 insertions(+)

diff --git a/config/Config-build.in b/config/Config-build.in
index 342859b7c0..adfb39d1b2 100644
--- a/config/Config-build.in
+++ b/config/Config-build.in
@@ -58,6 +58,15 @@ menu "Global build settings"
bool "Enable signature checking in opkg"
default SIGNED_PACKAGES
 
+   config BUILD_DOCUMENTATION
+   bool "Enable man/info components in builds"
+   default n
+   help
+ This option enables the build of doc and man pages in
+ components which allow conditional building of docs.
+ If unsure select "n" since we do not install
+ documentation in the target anyway.
+
comment "General build options"
 
config TESTING_KERNEL
-- 
2.27.0




--- End Message ---
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH 1/3] ccache: Build with ENABLE_DOCUMENTATION=OFF

2021-05-14 Thread David Adair via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---

This adjusts the Makefile to use the new option to turn off the
doc builds. It will not cause any problems except a warning
about unused options if combined with a ccache source missing
the upstream patch.

Since a config setting is required to re-enable the doc build this
is equivalent to unconditionally disabling the docs if the config
setting is not created.

Signed-off-by: David Adair 
---
 tools/ccache/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/ccache/Makefile b/tools/ccache/Makefile
index ff0204ae19..c69e26bd23 100644
--- a/tools/ccache/Makefile
+++ b/tools/ccache/Makefile
@@ -25,6 +25,9 @@ CMAKE_HOST_OPTIONS += \
-DCMAKE_SKIP_RPATH=FALSE \
-DCMAKE_INSTALL_RPATH="${STAGING_DIR_HOST}/lib" \
 
+ifneq (docs-$(CONFIG_BUILD_DOCUMENTATION),docs-y)
+CMAKE_HOST_OPTIONS += -DENABLE_DOCUMENTATION=OFF
+endif
 
 define Host/Install/ccache
$(INSTALL_DIR) $(STAGING_DIR_HOST)/bin/
-- 
2.27.0




--- End Message ---
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH 0/3] ccache: Disable Documentation build ( fix 21.02 build failure )

2021-05-14 Thread David Adair via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---

This is an alternative solution to the problem with 21.02-rc1 failing
to build due to non-ascii characters in the ccache man pages.  Rather
than fixing the failing man pages it uses the upstream pull/842 from
ynezz to disable generating the (unused) man pages completely.

The change is intended for 21.02 since master does not (currently) have
any build problems but it is divided into 3 parts for easier cherry
picking in case it is desired.

Will reply with patches once this shows up in archives.

Patch 1/3  ccache: Build with ENABLE_DOCUMENTATION=OFF
( generally useful )
This adjusts the Makefile to use the new option to turn off the doc
builds.  It will not cause any problems except a warning about
unused options if combined with a ccache source missing the
upstream patch.


Patch 2/3  config:  Add CONFIG_BUILD_DOCUMENTATION
( optional )
This is optional since the default used above is "n" but provides a
way to verify patch 1 works with "y".
It could potentially be useful:
 - If we want the default to be "y" e.g. keep building docs.
 - To document / reserve the CONFIG setting.
 - To supress docs on other packages. Would be most useful for the
   autoconf based tools but I could not figure out an easy way to
   accomplish that.

Patch 3/3 ccache: Add 030-make-documentation-optional.patch
( only for 21.02 )
This adds upstream commit b96ca763c453a602 as a patch to enable
patch 1/3.  It is currently only required for the 21.02 branch.


David Adair (3):
  ccache: Build with ENABLE_DOCUMENTATION=OFF
  menuconfig:  Add CONFIG_BUILD_DOCUMENTATION
  ccache: Add 030-make-documentation-optional.patch

 config/Config-build.in|  9 +
 tools/ccache/Makefile |  3 ++
 .../030-make-documentation-optional.patch | 37 +++
 3 files changed, 49 insertions(+)
 create mode 100644 tools/ccache/patches/030-make-documentation-
optional.patch

-- 
2.27.0



--- End Message ---
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: Re: [PATCH] ccache: don't use non-ASCII quotes

2021-05-12 Thread David Adair via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---
> I would rather prefer to disable[1] the documentation.
> 
> 1. https://github.com/ccache/ccache/pull/842

Thank you.  Zero maintenance is much better.

Since master has been updated to 4.2.1 which builds fine it seems no
change there is required until it also has this change.

Is there any interest in placing this in 21.02 along with the Makefile
c
hange to use it ?  The build failure is specific to ccache 4.1 and does
NOT occur using default config ( ccache and sdk disabled ).



--- End Message ---
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[PATCH] ccache: don't use non-ASCII quotes

2021-04-29 Thread David Adair via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---

Rebased upstream ccache commit: f6202db308e32f9b2 to correct
compilation errors with MANUAL.adoc due to non-ascii characters.

This change enables building 21.02-rc1 on a RHEL8 host where
"LANG=C" is apparently ascii rather than utf8.

Original fix:
Reported-by: Christophe PEREZ
Bug: https://bugs.gentoo.org/762814
Signed-off-by: Sergei Trofimovich 

Cleaned up backport to version 4.1 and added to ccache/patches
Signed-off-by: David Adair 
---
 tools/ccache/patches/020-fix-doc-utf.patch | 96 ++
 1 file changed, 96 insertions(+)
 create mode 100644 tools/ccache/patches/020-fix-doc-utf.patch

diff --git a/tools/ccache/patches/020-fix-doc-utf.patch 
b/tools/ccache/patches/020-fix-doc-utf.patch
new file mode 100644
index 00..981b1f4473
--- /dev/null
+++ b/tools/ccache/patches/020-fix-doc-utf.patch
@@ -0,0 +1,96 @@
+From 81e72af1dac607d57c55e40c1187ead52cc45e26 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich 
+Date: Mon, 11 Jan 2021 20:17:47 +
+Subject: [PATCH] doc/MANUAL.adoc: Don't use non-ASCII quotes (#761)
+
+Some locales like "LANG=fr_FR.iso885915@euro make" can't
+handle UTF-8 single- and double-quotes:
+
+$ LANG=fr_FR.iso885915@euro make
+...
+asciidoc: FAILED: MANUAL.adoc: line 529: unexpected error:
+...
+  File "/usr/lib/python3.8/encodings/iso8859_15.py", line 19, in encode
+return codecs.charmap_encode(input,self.errors,encoding_table)[0]
+UnicodeEncodeError: 'charmap' codec can't encode character '\u201c'
+  in position 54: character maps to 
+
+To avoid it the patch uses ASCII equivalents of symbols.
+
+The patch is generated as:
+
+$ sed \
+-e 's/\xE2\x80\x99/'\''/g' \
+-e 's/\xE2\x80\x9C/'\`\`'/g' \
+-e 's/\xE2\x80\x9D/'\'\''/g' \
+-i doc/MANUAL.adoc
+
+Reported-by: Christophe PEREZ
+Bug: https://bugs.gentoo.org/762814
+Signed-off-by: Sergei Trofimovich 
+---
+ doc/MANUAL.adoc | 24 
+ 1 file changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/doc/MANUAL.adoc b/doc/MANUAL.adoc
+index b7d89124..ec0c286a 100644
+--- a/doc/MANUAL.adoc
 b/doc/MANUAL.adoc
+@@ -517,9 +517,9 @@ Semantics of *compression_level*:
+ ratio. The maximum possible value depends on the libzstd version.
+ Decompression speed is essentially the same for all levels.
+ *< 0*::
+-A negative value corresponds to Zstandard's “ultra-fast” compression
++A negative value corresponds to Zstandard's ``ultra-fast'' compression
+ levels, which are even faster than level 1 but with less good compression
+-ratios. For instance, level *-3* corresponds to “--fast=3” for the *zstd*
++ratios. For instance, level *-3* corresponds to ``--fast=3'' for the 
*zstd*
+ command line tool.
+ *0* (default)::
+ The value *0* means that ccache will choose a suitable level, currently
+@@ -564,8 +564,8 @@ Semantics of *compression_level*:
+ 
+ [[config_file_clone]] *file_clone* (*CCACHE_FILECLONE* or 
*CCACHE_NOFILECLONE*, see <<_boolean_values,Boolean values>> above)::
+ 
+-If true, ccache will attempt to use file cloning (also known as “copy on
+-write”, “CoW” or “reflinks”) to store and fetch cached compiler results.
++If true, ccache will attempt to use file cloning (also known as ``copy on
++write'', ``CoW'' or ``reflinks'') to store and fetch cached compiler 
results.
+ *file_clone* has priority over <>. The
+ default is false.
+ +
+@@ -921,11 +921,11 @@ Incompressible data:  3.5 GB
+ 
+ Notes:
+ 
+-* The “disk blocks” size is the cache size when taking disk block size into
+-  account. This value should match the “cache size” value from “ccache
+-  --show-stats”. The other size numbers refer to actual content sizes.
+-* “Compressed data” refers to result and manifest files stored in the cache.
+-* “Incompressible data” refers to files that are always stored uncompressed
++* The ``disk blocks'' size is the cache size when taking disk block size into
++  account. This value should match the ``cache size'' value from ``ccache
++  --show-stats''. The other size numbers refer to actual content sizes.
++* ``Compressed data'' refers to result and manifest files stored in the cache.
++* ``Incompressible data'' refers to files that are always stored uncompressed
+   (triggered by enabling <> or
+   <>) or unknown files (for instance files
+   created by older ccache versions).
+@@ -1238,11 +1238,11 @@ In the direct mode, ccache uses the 160 bit BLAKE3 
hash of the
+ the *ccache-input-c* + *ccache-input-p* data is used in the preprocessor mode.
+ 
+ The *ccache-input-text* file is a combined text version of the three
+-binary input files. It has three sections (“COMMON”, “DIRECT MODE” and
+-“PREPROCESSOR MODE”), which is turn contain annotations that