From patchwork Thu Apr 11 13:35:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alexis_Lothor=C3=A9?= X-Patchwork-Id: 1922544 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VFggM12ylz1yYL for ; Thu, 11 Apr 2024 23:35:27 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 56BEE405EE; Thu, 11 Apr 2024 13:35:23 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id QmsvMpvOpQxq; Thu, 11 Apr 2024 13:35:22 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 7C7B041A3E Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id 7C7B041A3E; Thu, 11 Apr 2024 13:35:21 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id BC6121BF3DB for ; Thu, 11 Apr 2024 13:35:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id A997380E3E for ; Thu, 11 Apr 2024 13:35:16 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id G9bz1rdFwF6d for ; Thu, 11 Apr 2024 13:35:15 +0000 (UTC) X-Greylist: delayed 17152 seconds by postgrey-1.37 at util1.osuosl.org; Thu, 11 Apr 2024 13:35:15 UTC DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 3D06781256 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 3D06781256 Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=217.70.183.193; helo=relay1-d.mail.gandi.net; envelope-from=alexis.lothore@bootlin.com; receiver= Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by smtp1.osuosl.org (Postfix) with ESMTPS id 3D06781256 for ; Thu, 11 Apr 2024 13:35:14 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id 5DAC8240010; Thu, 11 Apr 2024 13:35:12 +0000 (UTC) To: buildroot@buildroot.org Date: Thu, 11 Apr 2024 15:35:05 +0200 Message-ID: <20240411133507.82781-2-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240411133507.82781-1-alexis.lothore@bootlin.com> References: <20240411133507.82781-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 X-GND-Sasl: alexis.lothore@bootlin.com X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1712842512; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JQPoHwE6OxrUoPsNASviK7oIGNjqVyT7nR7MCwjtDJs=; b=SK/9PczidI54T/gQb5TSlomcjPYbr326h6yTw0796B/3Xn7s4Af7PkQeuiBbFHe5rIDHpY 0leoTidsh8IH5PKNMqC5SS/e3crFYTw4Ok0lyLyRr356fAoeenNN3m5aHplW8zDRuMwBXo 1euyizoJrh6NJ4gZ1kgVUCVZ1/ZWtA6Nz8oYW9N7D1wCDR6h5Mq1PwCNsRmfhwL5wlhHX4 FRU0VDBPTLmZu9oPFXcdRdtqkrnclUZueTIkwvATmz/FwPpXY5b/zn3qZQDuVNLPB1Y3hs bSC6Tx5+ccCheHK6Wvtrv+/eLwRmgTT72WcdPBD+uRTG/jblsc8rEshjZdfEOg== X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=gm1 header.b=SK/9Pczi Subject: [Buildroot] [PATCH v2 1/3] package/pppd: revert lock path X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Alexis_Lothor=C3=A9_via_buildroot?= From: =?utf-8?q?Alexis_Lothor=C3=A9?= Reply-To: =?utf-8?q?Alexis_Lothor=C3=A9?= Cc: Bernd Kuhls , Nicolas Carrier , Thomas Petazzoni Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" pppd fails to start on buildroot 2024.02, because of non-existing directory pppd in /var/run Signed-off-by: Alexis Lothoré --- ...005-Revert-lock-path-to-var-lock-435.patch | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 package/pppd/0005-Revert-lock-path-to-var-lock-435.patch diff --git a/package/pppd/0005-Revert-lock-path-to-var-lock-435.patch b/package/pppd/0005-Revert-lock-path-to-var-lock-435.patch new file mode 100644 index 000000000000..6f3237144466 --- /dev/null +++ b/package/pppd/0005-Revert-lock-path-to-var-lock-435.patch @@ -0,0 +1,66 @@ +From 50aec48624b76d9ebb8b49309c3bfd3463745a26 Mon Sep 17 00:00:00 2001 +From: Dominique Martinet +Date: Tue, 10 Oct 2023 10:05:50 +0900 +Subject: [PATCH] Revert lock path to /var/lock (#435) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +lock dir changed on linux from /var/lock to /run/pppd/lock with +pppd-2.5.0, which makes pppd fail to start if the distribution does not +pre-create the directory. + +This reverts it back to /var/lock. + +The paths for other OS should be identical as LOCALSTATEDIR should be +/var, but also revert them back as well just in case. +Since the variable is no longer used remove it from makefiles. + +Fixes: 66a8c74c3f73 ("Let ./configure control the paths for pppd") +Fixes: #419 + +Signed-off-by: Dominique Martinet +Co-authored-by: Dominique Martinet +Upstream: https://github.com/ppp-project/ppp/commit/99cbf5e269994482edaf64624be8b1c806f9587c +Signed-off-by: Alexis Lothoré +--- + pppd/Makefile.am | 2 +- + pppd/pathnames.h | 6 +++--- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/pppd/Makefile.am b/pppd/Makefile.am +index e5bedf26af96..7cb30053322e 100644 +--- a/pppd/Makefile.am ++++ b/pppd/Makefile.am +@@ -83,7 +83,7 @@ pppd_SOURCES = \ + upap.c \ + utils.c + +-pppd_CPPFLAGS = -DSYSCONFDIR=\"${sysconfdir}\" -DLOCALSTATEDIR=\"${localstatedir}\" -DPPPD_RUNTIME_DIR='"@PPPD_RUNTIME_DIR@"' -DPPPD_LOGFILE_DIR='"@PPPD_LOGFILE_DIR@"' ++pppd_CPPFLAGS = -DSYSCONFDIR=\"${sysconfdir}\" -DPPPD_RUNTIME_DIR='"@PPPD_RUNTIME_DIR@"' -DPPPD_LOGFILE_DIR='"@PPPD_LOGFILE_DIR@"' + pppd_LDFLAGS = + pppd_LIBS = + +diff --git a/pppd/pathnames.h b/pppd/pathnames.h +index de2fb6889005..12609a969429 100644 +--- a/pppd/pathnames.h ++++ b/pppd/pathnames.h +@@ -120,12 +120,12 @@ + #define PPP_PATH_PPPDB PPP_PATH_VARRUN "/pppd2.tdb" + + #ifdef __linux__ +-#define PPP_PATH_LOCKDIR PPP_PATH_VARRUN "/lock" ++#define PPP_PATH_LOCKDIR "/var/lock" + #else + #ifdef SVR4 +-#define PPP_PATH_LOCKDIR LOCALSTATEDIR "/spool/locks" ++#define PPP_PATH_LOCKDIR "/var/spool/locks" + #else +-#define PPP_PATH_LOCKDIR LOCALSTATEDIR "/spool/lock" ++#define PPP_PATH_LOCKDIR "/var/spool/lock" + #endif + #endif + +-- +2.44.0 + From patchwork Thu Apr 11 13:35:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alexis_Lothor=C3=A9?= X-Patchwork-Id: 1922546 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VFggS4chNz1yYL for ; Thu, 11 Apr 2024 23:35:32 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 8F65741959; Thu, 11 Apr 2024 13:35:30 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id OPphC4FhZysF; Thu, 11 Apr 2024 13:35:29 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org DF0C941A40 Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id DF0C941A40; Thu, 11 Apr 2024 13:35:28 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id EFD121BF3DB for ; Thu, 11 Apr 2024 13:35:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C9FDC612A1 for ; Thu, 11 Apr 2024 13:35:16 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id MUokmeNquGRu for ; Thu, 11 Apr 2024 13:35:15 +0000 (UTC) X-Greylist: delayed 17154 seconds by postgrey-1.37 at util1.osuosl.org; Thu, 11 Apr 2024 13:35:14 UTC DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 014C560632 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 014C560632 Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2001:4b98:dc4:8::221; helo=relay1-d.mail.gandi.net; envelope-from=alexis.lothore@bootlin.com; receiver= Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::221]) by smtp3.osuosl.org (Postfix) with ESMTPS id 014C560632 for ; Thu, 11 Apr 2024 13:35:14 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id A6933240009; Thu, 11 Apr 2024 13:35:12 +0000 (UTC) To: buildroot@buildroot.org Date: Thu, 11 Apr 2024 15:35:06 +0200 Message-ID: <20240411133507.82781-3-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240411133507.82781-1-alexis.lothore@bootlin.com> References: <20240411133507.82781-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 X-GND-Sasl: alexis.lothore@bootlin.com X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1712842512; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fwy9GpZROOJ32/cxY4vqGrlt3IXItizolMGsycpQyKM=; b=Jc+UeI0VIMul3zduOXqP5kYGcqJdaCA0QsX6B2vbMEfsMB9gl7jxnjhlnaxccq4HIlbq5A /xykkkmW/CvWE7xVw0iyYgqeNMKtwB9HYMe5Y0OyyzrgIzH/vZTRsR1C6HOvcrzEoVOUI7 BGN27BqDWEXdfiVUpls90EKmRdRd4mG/0pMmQlTSO4voXJMSLPVXEMzK+X7Iotshyty+EK dK6imMxH6ZXUHe+u/luz4YH+y3UgupCKkbvhD+wFXGgCduhZN3N3owzvY0zTgCVMzqHcMV 9/9IOpIdf7BbRmUCtoXTb64YroSyY5pFEn9ACSojZxwsTW6NNkJIIusDpK4OGQ== X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=gm1 header.b=Jc+UeI0V Subject: [Buildroot] [PATCH v2 2/3] package/pppd: add mkdir recursive X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Alexis_Lothor=C3=A9_via_buildroot?= From: =?utf-8?q?Alexis_Lothor=C3=A9?= Reply-To: =?utf-8?q?Alexis_Lothor=C3=A9?= Cc: Bernd Kuhls , Nicolas Carrier , Thomas Petazzoni Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" pppd fails to start on buildroot 2024.02, because of non-existing directory pppd in /var/run Signed-off-by: Alexis Lothoré --- .../pppd/0006-utils-add-mkdir_recursive.patch | 294 ++++++++++++++++++ 1 file changed, 294 insertions(+) create mode 100644 package/pppd/0006-utils-add-mkdir_recursive.patch diff --git a/package/pppd/0006-utils-add-mkdir_recursive.patch b/package/pppd/0006-utils-add-mkdir_recursive.patch new file mode 100644 index 000000000000..fa52ee075830 --- /dev/null +++ b/package/pppd/0006-utils-add-mkdir_recursive.patch @@ -0,0 +1,294 @@ +From 2c1e12a7ebacc9b18b7c34f55bf01b75b292c2d9 Mon Sep 17 00:00:00 2001 +From: Dominique Martinet +Date: Wed, 30 Aug 2023 11:46:01 +0900 +Subject: [PATCH] utils: add mkdir_recursive +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This will be used in the next commit. + +A test file for utils has also been added to check mkdir works as +intended. + +Signed-off-by: Dominique Martinet +Upstream: https://github.com/ppp-project/ppp/commit/b0e7307b3569a5dad0f2606d2736cc8317851598 +Signed-off-by: Alexis Lothoré +--- + pppd/Makefile.am | 6 ++ + pppd/pppd-private.h | 1 + + pppd/utils.c | 82 ++++++++++++++++++++++++++ + pppd/utils_utest.c | 139 ++++++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 228 insertions(+) + create mode 100644 pppd/utils_utest.c + +diff --git a/pppd/Makefile.am b/pppd/Makefile.am +index 7cb30053322e..c5fe10776ede 100644 +--- a/pppd/Makefile.am ++++ b/pppd/Makefile.am +@@ -20,6 +20,12 @@ utest_pppcrypt_LDFLAGS = + + check_PROGRAMS += utest_crypto + ++utest_utils_SOURCES = utils.c utils_utest.c ++utest_utils_CPPFLAGS = -DUNIT_TEST ++utest_utils_LDFLAGS = ++ ++check_PROGRAMS += utest_utils ++ + if WITH_SRP + sbin_PROGRAMS += srp-entry + dist_man8_MANS += srp-entry.8 +diff --git a/pppd/pppd-private.h b/pppd/pppd-private.h +index 2883e4622acb..46ce0c8bdceb 100644 +--- a/pppd/pppd-private.h ++++ b/pppd/pppd-private.h +@@ -437,6 +437,7 @@ int sifproxyarp(int, u_int32_t); + int cifproxyarp(int, u_int32_t); + /* Delete proxy ARP entry for peer */ + u_int32_t GetMask(u_int32_t); /* Get appropriate netmask for address */ ++int mkdir_recursive(const char *); /* Recursively create directory */ + int lock(char *); /* Create lock file for device */ + int relock(int); /* Rewrite lock file with new pid */ + void unlock(void); /* Delete previously-created lock file */ +diff --git a/pppd/utils.c b/pppd/utils.c +index c1bdbbbfe4e5..c47192e67fef 100644 +--- a/pppd/utils.c ++++ b/pppd/utils.c +@@ -781,6 +781,88 @@ complete_read(int fd, void *buf, size_t count) + } + #endif + ++/* ++ * mkdir_check - helper for mkdir_recursive, creates a directory ++ * but do not error on EEXIST if and only if entry is a directory ++ * The caller must check for errno == ENOENT if appropriate. ++ */ ++static int ++mkdir_check(const char *path) ++{ ++ struct stat statbuf; ++ ++ if (mkdir(path, 0755) >= 0) ++ return 0; ++ ++ if (errno == EEXIST) { ++ if (stat(path, &statbuf) < 0) ++ /* got raced? */ ++ return -1; ++ ++ if ((statbuf.st_mode & S_IFMT) == S_IFDIR) ++ return 0; ++ ++ /* already exists but not a dir, treat as failure */ ++ errno = EEXIST; ++ return -1; ++ } ++ ++ return -1; ++} ++ ++/* ++ * mkdir_parent - helper for mkdir_recursive, modifies the string in place ++ * Assumes mkdir(path) already failed, so it first creates the parent then ++ * full path again. ++ */ ++static int ++mkdir_parent(char *path) ++{ ++ char *slash; ++ int rc; ++ ++ slash = strrchr(path, '/'); ++ if (!slash) ++ return -1; ++ ++ *slash = 0; ++ if (mkdir_check(path) < 0) { ++ if (errno != ENOENT) { ++ *slash = '/'; ++ return -1; ++ } ++ if (mkdir_parent(path) < 0) { ++ *slash = '/'; ++ return -1; ++ } ++ } ++ *slash = '/'; ++ ++ return mkdir_check(path); ++} ++ ++/* ++ * mkdir_recursive - recursively create directory if it didn't exist ++ */ ++int ++mkdir_recursive(const char *path) ++{ ++ char *copy; ++ int rc; ++ ++ // optimistically try on full path first to avoid allocation ++ if (mkdir_check(path) == 0) ++ return 0; ++ ++ copy = strdup(path); ++ if (!copy) ++ return -1; ++ ++ rc = mkdir_parent(copy); ++ free(copy); ++ return rc; ++} ++ + /* Procedures for locking the serial device using a lock file. */ + static char lock_file[MAXPATHLEN]; + +diff --git a/pppd/utils_utest.c b/pppd/utils_utest.c +new file mode 100644 +index 000000000000..cdca97e6d025 +--- /dev/null ++++ b/pppd/utils_utest.c +@@ -0,0 +1,139 @@ ++#include ++#include ++#include ++#include ++ ++#include "pppd-private.h" ++ ++/* globals used in test.c... */ ++int debug = 1; ++int error_count; ++int unsuccess; ++ ++/* check if path exists and returns its type */ ++static int ++file_type(char *path) ++{ ++ struct stat statbuf; ++ ++ if (stat(path, &statbuf) < 0) ++ return -1; ++ ++ return statbuf.st_mode & S_IFMT; ++} ++ ++int ++test_simple() { ++ if (mkdir_recursive("dir")) ++ return -1; ++ ++ if (file_type("dir") != S_IFDIR) ++ return -1; ++ ++ rmdir("dir"); ++ return 0; ++} ++ ++int ++test_recurse() { ++ if (mkdir_recursive("dir/subdir/subsubdir")) ++ return -1; ++ ++ if (file_type("dir/subdir/subsubdir") != S_IFDIR) ++ return -1; ++ ++ rmdir("dir/subdir/subsubdir"); ++ ++ /* try again with partial existence */ ++ if (mkdir_recursive("dir/subdir/subsubdir")) ++ return -1; ++ ++ if (file_type("dir/subdir/subsubdir") != S_IFDIR) ++ return -1; ++ ++ rmdir("dir/subdir/subsubdir"); ++ rmdir("dir/subdir"); ++ rmdir("dir"); ++ return 0; ++} ++ ++int ++test_recurse_multislash() { ++ if (mkdir_recursive("dir/subdir///subsubdir")) ++ return -1; ++ ++ if (file_type("dir/subdir/subsubdir") != S_IFDIR) ++ return -1; ++ ++ rmdir("dir/subdir/subsubdir"); ++ rmdir("dir/subdir"); ++ ++ /* try again with partial existence */ ++ if (mkdir_recursive("dir/subdir/subsubdir///")) ++ return -1; ++ ++ if (file_type("dir/subdir/subsubdir") != S_IFDIR) ++ return -1; ++ ++ rmdir("dir/subdir/subsubdir"); ++ rmdir("dir/subdir"); ++ rmdir("dir"); ++ return 0; ++} ++ ++int ++test_parent_notdir() { ++ int fd = open("file", O_CREAT, 0600); ++ if (fd < 0) ++ return -1; ++ close(fd); ++ ++ if (mkdir_recursive("file") == 0) ++ return -1; ++ if (mkdir_recursive("file/dir") == 0) ++ return -1; ++ ++ unlink("file"); ++ return 0; ++} ++ ++int ++main() ++{ ++ char *base_dir = strdup("/tmp/ppp_utils_utest.XXXXXX"); ++ int failure = 0; ++ ++ if (mkdtemp(base_dir) == NULL) { ++ printf("Could not create test directory, aborting\n"); ++ return 1; ++ } ++ ++ if (chdir(base_dir) < 0) { ++ printf("Could not enter newly created test dir, aborting\n"); ++ return 1; ++ } ++ ++ if (test_simple()) { ++ printf("Could not create simple directory\n"); ++ failure++; ++ } ++ ++ if (test_recurse()) { ++ printf("Could not create recursive directory\n"); ++ failure++; ++ } ++ ++ if (test_recurse_multislash()) { ++ printf("Could not create recursive directory with multiple slashes\n"); ++ failure++; ++ } ++ ++ if (test_parent_notdir()) { ++ printf("Creating over a file appeared to work?\n"); ++ failure++; ++ } ++ ++ rmdir(base_dir); ++ free(base_dir); ++ return failure; ++} +-- +2.44.0 + From patchwork Thu Apr 11 13:35:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alexis_Lothor=C3=A9?= X-Patchwork-Id: 1922545 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VFggP4vSWz1yYL for ; Thu, 11 Apr 2024 23:35:29 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id EB63541A2B; Thu, 11 Apr 2024 13:35:26 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id FCe9bOtxshNG; Thu, 11 Apr 2024 13:35:25 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 384B441A37 Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id 384B441A37; Thu, 11 Apr 2024 13:35:25 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id EC8F21BF3DB for ; Thu, 11 Apr 2024 13:35:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 8ADD96129E for ; Thu, 11 Apr 2024 13:35:16 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id mQmtoAK7dBHo for ; Thu, 11 Apr 2024 13:35:15 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2001:4b98:dc4:8::221; helo=relay1-d.mail.gandi.net; envelope-from=alexis.lothore@bootlin.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 41ECA612A1 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 41ECA612A1 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::221]) by smtp3.osuosl.org (Postfix) with ESMTPS id 41ECA612A1 for ; Thu, 11 Apr 2024 13:35:14 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id EEFC3240005; Thu, 11 Apr 2024 13:35:12 +0000 (UTC) To: buildroot@buildroot.org Date: Thu, 11 Apr 2024 15:35:07 +0200 Message-ID: <20240411133507.82781-4-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240411133507.82781-1-alexis.lothore@bootlin.com> References: <20240411133507.82781-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 X-GND-Sasl: alexis.lothore@bootlin.com X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1712842513; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=efamNpgUN7aoAQ1rzXFgbty8d82m+xEwfmj67o4CGH0=; b=MYH/3HZydN+sKdnAh7nAKIT54D0kzZchRLBQkRFmPMog6z7XPRreYOdej1jHjLrLwj3jed Yr7qyHrCXra6JAlkxAY5gwaYu5w0x8TsmFXt6nN+M9xOtX3/+T3ls4WH30TYtV08VdBmJO ekbWj6mw3FjazqqRdxGtYBR8XFxeRSTjZem9BSIGXQ4GE1C8RrFcAGDim/of6X5cWPe+Wg O+aXgLulqSAO8S5UXxuQ38aJtT1PIySwlBiK3Dwin827UuvoT9zkEZhAjY48SK3/AG4Jid 5OKw/qV9wN0ZqIp1t2Gd0xzyBJM6PYdHi2LG23ktQ4Xm+asQ7D5A36YajjTuIw== X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=gm1 header.b=MYH/3HZy Subject: [Buildroot] [PATCH v2 3/3] package/pppd: create rundir when it is missing X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Alexis_Lothor=C3=A9_via_buildroot?= From: =?utf-8?q?Alexis_Lothor=C3=A9?= Reply-To: =?utf-8?q?Alexis_Lothor=C3=A9?= Cc: Bernd Kuhls , Nicolas Carrier , Thomas Petazzoni Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" pppd fails to start on buildroot 2024.02, because of non-existing directory pppd in /var/run Signed-off-by: Alexis Lothoré --- ...0007-try-to-create-rundir-if-missing.patch | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 package/pppd/0007-try-to-create-rundir-if-missing.patch diff --git a/package/pppd/0007-try-to-create-rundir-if-missing.patch b/package/pppd/0007-try-to-create-rundir-if-missing.patch new file mode 100644 index 000000000000..d223abf801bf --- /dev/null +++ b/package/pppd/0007-try-to-create-rundir-if-missing.patch @@ -0,0 +1,52 @@ +From 8ef2b1d5e13540cfb365490ea1ed131784184c1a Mon Sep 17 00:00:00 2001 +From: Dominique Martinet +Date: Thu, 3 Aug 2023 16:37:27 +0900 +Subject: [PATCH] try to create rundir if missing +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Runtime dir changed from /run to /run/pppd in commit 66a8c74c3f73 ("Let +./configure control the paths for pppd") and is likely to not exist on +some distros, in which case the pppdb will not be created. + +See: #419 (lock directory moved in ppp-2.5.0) +Signed-off-by: Dominique Martinet +Upstream: https://github.com/ppp-project/ppp/commit/3a4fec968174fd6f387d5ec872a56343f256f645 +Signed-off-by: Alexis Lothoré +--- + pppd/tdb.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/pppd/tdb.c b/pppd/tdb.c +index 8a563f88b9a6..62644171aa6e 100644 +--- a/pppd/tdb.c ++++ b/pppd/tdb.c +@@ -60,8 +60,11 @@ + #include + #include + #include ++ ++#include "pppd-private.h" + #include "tdb.h" + #include "spinlock.h" ++#include "pathnames.h" + + #define TDB_MAGIC_FOOD "TDB file\n" + #define TDB_VERSION (0x26011967 + 6) +@@ -1728,7 +1731,12 @@ TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags, + goto internal; + } + ++again: + if ((tdb->fd = open(name, open_flags, mode)) == -1) { ++ if ((open_flags & O_CREAT) && errno == ENOENT && ++ mkdir_recursive(PPP_PATH_VARRUN) == 0) ++ goto again; ++ + TDB_LOG((tdb, 5, "tdb_open_ex: could not open file %s: %s\n", + name, strerror(errno))); + goto fail; /* errno set by open(2) */ +-- +2.44.0 +