All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cross-localedef-native : fixup filesystem check error
@ 2025-02-13  6:42 Xiaofeng Yuan
  2025-02-13  7:51 ` Khem Raj
  0 siblings, 1 reply; 3+ messages in thread
From: Xiaofeng Yuan @ 2025-02-13  6:42 UTC (permalink / raw)
  To: openembedded-core; +Cc: Xiaofeng Yuan, Jason Wessel, Khem Raj

compile glibc-locale triger error, the error info
is "cross-localedef-native: /xxx/glibc-locale/2.40+git/
locale-tree/Makefile is on different filesystem than rest
(use -f option to override)." But check the file, find it's
filesystem is same as the rest. Now use the f_type instead of
dev_t to check the filesystem.

Change-Id: I62d840dd74467e8e1afd6e322b05ce012d35458c

Signed-off-by: Xiaofeng Yuan <yuanxiaofeng@eswincomputing.com>

CC: Jason Wessel <jason.wessel@windriver.com>
CC: Khem Raj <raj.khem@gmail.com>
Change-Id: I0cf8f143dc4a38fc1835439f4d5e7641832b7a81
---
 .../glibc/cross-localedef-native_2.40.bb      |  1 +
 ...ixup-hardlink-filesystem-check-error.patch | 78 +++++++++++++++++++
 2 files changed, 79 insertions(+)
 create mode 100644 meta/recipes-core/glibc/glibc/0001-localedef-fixup-hardlink-filesystem-check-error.patch

diff --git a/meta/recipes-core/glibc/cross-localedef-native_2.40.bb b/meta/recipes-core/glibc/cross-localedef-native_2.40.bb
index fed6e4ea97..15204f3744 100644
--- a/meta/recipes-core/glibc/cross-localedef-native_2.40.bb
+++ b/meta/recipes-core/glibc/cross-localedef-native_2.40.bb
@@ -32,6 +32,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
            file://0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \
            file://0017-Replace-echo-with-printf-builtin-in-nscd-init-script.patch \
            file://0019-timezone-Make-shell-interpreter-overridable-in-tzsel.patch \
+           file://0001-localedef-fixup-hardlink-filesystem-check-error.patch \
            "
 # Makes for a rather long rev (22 characters), but...
 #
diff --git a/meta/recipes-core/glibc/glibc/0001-localedef-fixup-hardlink-filesystem-check-error.patch b/meta/recipes-core/glibc/glibc/0001-localedef-fixup-hardlink-filesystem-check-error.patch
new file mode 100644
index 0000000000..a7b3e01259
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0001-localedef-fixup-hardlink-filesystem-check-error.patch
@@ -0,0 +1,78 @@
+From af6fa1c52d1f83f7a16adf6fa6241269e0034b0b Mon Sep 17 00:00:00 2001
+From: Xiaofeng Yuan <yuanxiaofeng@eswincomputing.com>
+Date: Thu, 13 Feb 2025 11:46:59 +0800
+Subject: [PATCH] cross-localedef-native : fixup filesystem check error
+
+Since ordinary files and directories within the same
+directory but on the same filesystem may have different dev_t,
+using dev_t to determine whether files (including directories)
+belong to the same file system is unreliable and may lead to
+incorrect results. To address this issue, statfs is used to
+retrieve the filesystem information, allowing the determination
+of whether files belong to the same file system.
+
+Upstream-Status: Pending
+
+Signed-off-by: Xiaofeng Yuan <yuanxiaofeng@eswincomputing.com>
+---
+ locale/programs/cross-localedef-hardlink.c | 32 +++++++++++++---------
+ 1 file changed, 19 insertions(+), 13 deletions(-)
+
+diff --git a/locale/programs/cross-localedef-hardlink.c b/locale/programs/cross-localedef-hardlink.c
+index 726e6dd948..a51f076923 100644
+--- a/locale/programs/cross-localedef-hardlink.c
++++ b/locale/programs/cross-localedef-hardlink.c
+@@ -42,6 +42,7 @@
+ #include "xalloc.h"
+ //#include "nls.h"
+ //#include "closestream.h"
++#include <sys/statfs.h>
+ 
+ #define NHASH   (1<<17)  /* Must be a power of 2! */
+ #define NBUF    64
+@@ -93,6 +94,7 @@ struct hardlink_ctl {
+ 		no_link:1,
+ 		content_only:1,
+ 		force:1;
++	long f_type;
+ };
+ /* ctl is in global scope due use in atexit() */
+ struct hardlink_ctl global_ctl;
+@@ -185,20 +187,24 @@ static void growstr(struct hardlink_dynstr *str, size_t newlen)
+ 
+ static void process_path(struct hardlink_ctl *ctl, const char *name)
+ {
+-	struct stat st, st2, st3;
+-	const size_t namelen = strlen(name);
++        struct stat st, st2, st3;
++        struct statfs stfs;
++        const size_t namelen = strlen(name);
++
++        ctl->nobjects++;
++        if (lstat(name, &st))
++                return;
++        if (statfs(name, &stfs))
++                return;
++
++        if (stfs.f_type != ctl->f_type && !ctl->force) {
++                if (ctl->f_type)
++                        errx(EXIT_FAILURE,
++                             ("%s is on different filesystem than the rest "
++                               "(use -f option to override)."), name);
++                ctl->f_type = stfs.f_type;
++        }
+ 
+-	ctl->nobjects++;
+-	if (lstat(name, &st))
+-		return;
+-
+-	if (st.st_dev != ctl->dev && !ctl->force) {
+-		if (ctl->dev)
+-			errx(EXIT_FAILURE,
+-			     ("%s is on different filesystem than the rest "
+-			       "(use -f option to override)."), name);
+-		ctl->dev = st.st_dev;
+-	}
+ 	if (S_ISDIR(st.st_mode)) {
+ 		struct hardlink_dir *dp = xmalloc(add3(sizeof(*dp), namelen, 1));
+ 		memcpy(dp->name, name, namelen + 1);



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] cross-localedef-native : fixup filesystem check error
  2025-02-13  6:42 [PATCH] cross-localedef-native : fixup filesystem check error Xiaofeng Yuan
@ 2025-02-13  7:51 ` Khem Raj
  2025-02-13  9:48   ` 袁晓峰
  0 siblings, 1 reply; 3+ messages in thread
From: Khem Raj @ 2025-02-13  7:51 UTC (permalink / raw)
  To: Xiaofeng Yuan; +Cc: openembedded-core, Jason Wessel

Can you format the patch to match the style and also create a PR on
githut for cross-localedef?

On Wed, Feb 12, 2025 at 10:42 PM Xiaofeng Yuan
<yuanxiaofeng@eswincomputing.com> wrote:
>
> compile glibc-locale triger error, the error info
> is "cross-localedef-native: /xxx/glibc-locale/2.40+git/
> locale-tree/Makefile is on different filesystem than rest
> (use -f option to override)." But check the file, find it's
> filesystem is same as the rest. Now use the f_type instead of
> dev_t to check the filesystem.
>
> Change-Id: I62d840dd74467e8e1afd6e322b05ce012d35458c
>
> Signed-off-by: Xiaofeng Yuan <yuanxiaofeng@eswincomputing.com>
>
> CC: Jason Wessel <jason.wessel@windriver.com>
> CC: Khem Raj <raj.khem@gmail.com>
> Change-Id: I0cf8f143dc4a38fc1835439f4d5e7641832b7a81
> ---
>  .../glibc/cross-localedef-native_2.40.bb      |  1 +
>  ...ixup-hardlink-filesystem-check-error.patch | 78 +++++++++++++++++++
>  2 files changed, 79 insertions(+)
>  create mode 100644 meta/recipes-core/glibc/glibc/0001-localedef-fixup-hardlink-filesystem-check-error.patch
>
> diff --git a/meta/recipes-core/glibc/cross-localedef-native_2.40.bb b/meta/recipes-core/glibc/cross-localedef-native_2.40.bb
> index fed6e4ea97..15204f3744 100644
> --- a/meta/recipes-core/glibc/cross-localedef-native_2.40.bb
> +++ b/meta/recipes-core/glibc/cross-localedef-native_2.40.bb
> @@ -32,6 +32,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
>             file://0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \
>             file://0017-Replace-echo-with-printf-builtin-in-nscd-init-script.patch \
>             file://0019-timezone-Make-shell-interpreter-overridable-in-tzsel.patch \
> +           file://0001-localedef-fixup-hardlink-filesystem-check-error.patch \
>             "
>  # Makes for a rather long rev (22 characters), but...
>  #
> diff --git a/meta/recipes-core/glibc/glibc/0001-localedef-fixup-hardlink-filesystem-check-error.patch b/meta/recipes-core/glibc/glibc/0001-localedef-fixup-hardlink-filesystem-check-error.patch
> new file mode 100644
> index 0000000000..a7b3e01259
> --- /dev/null
> +++ b/meta/recipes-core/glibc/glibc/0001-localedef-fixup-hardlink-filesystem-check-error.patch
> @@ -0,0 +1,78 @@
> +From af6fa1c52d1f83f7a16adf6fa6241269e0034b0b Mon Sep 17 00:00:00 2001
> +From: Xiaofeng Yuan <yuanxiaofeng@eswincomputing.com>
> +Date: Thu, 13 Feb 2025 11:46:59 +0800
> +Subject: [PATCH] cross-localedef-native : fixup filesystem check error
> +
> +Since ordinary files and directories within the same
> +directory but on the same filesystem may have different dev_t,
> +using dev_t to determine whether files (including directories)
> +belong to the same file system is unreliable and may lead to
> +incorrect results. To address this issue, statfs is used to
> +retrieve the filesystem information, allowing the determination
> +of whether files belong to the same file system.
> +
> +Upstream-Status: Pending
> +
> +Signed-off-by: Xiaofeng Yuan <yuanxiaofeng@eswincomputing.com>
> +---
> + locale/programs/cross-localedef-hardlink.c | 32 +++++++++++++---------
> + 1 file changed, 19 insertions(+), 13 deletions(-)
> +
> +diff --git a/locale/programs/cross-localedef-hardlink.c b/locale/programs/cross-localedef-hardlink.c
> +index 726e6dd948..a51f076923 100644
> +--- a/locale/programs/cross-localedef-hardlink.c
> ++++ b/locale/programs/cross-localedef-hardlink.c
> +@@ -42,6 +42,7 @@
> + #include "xalloc.h"
> + //#include "nls.h"
> + //#include "closestream.h"
> ++#include <sys/statfs.h>
> +
> + #define NHASH   (1<<17)  /* Must be a power of 2! */
> + #define NBUF    64
> +@@ -93,6 +94,7 @@ struct hardlink_ctl {
> +               no_link:1,
> +               content_only:1,
> +               force:1;
> ++      long f_type;
> + };
> + /* ctl is in global scope due use in atexit() */
> + struct hardlink_ctl global_ctl;
> +@@ -185,20 +187,24 @@ static void growstr(struct hardlink_dynstr *str, size_t newlen)
> +
> + static void process_path(struct hardlink_ctl *ctl, const char *name)
> + {
> +-      struct stat st, st2, st3;
> +-      const size_t namelen = strlen(name);
> ++        struct stat st, st2, st3;
> ++        struct statfs stfs;
> ++        const size_t namelen = strlen(name);
> ++
> ++        ctl->nobjects++;
> ++        if (lstat(name, &st))
> ++                return;
> ++        if (statfs(name, &stfs))
> ++                return;
> ++
> ++        if (stfs.f_type != ctl->f_type && !ctl->force) {
> ++                if (ctl->f_type)
> ++                        errx(EXIT_FAILURE,
> ++                             ("%s is on different filesystem than the rest "
> ++                               "(use -f option to override)."), name);
> ++                ctl->f_type = stfs.f_type;
> ++        }
> +
> +-      ctl->nobjects++;
> +-      if (lstat(name, &st))
> +-              return;
> +-
> +-      if (st.st_dev != ctl->dev && !ctl->force) {
> +-              if (ctl->dev)
> +-                      errx(EXIT_FAILURE,
> +-                           ("%s is on different filesystem than the rest "
> +-                             "(use -f option to override)."), name);
> +-              ctl->dev = st.st_dev;
> +-      }
> +       if (S_ISDIR(st.st_mode)) {
> +               struct hardlink_dir *dp = xmalloc(add3(sizeof(*dp), namelen, 1));
> +               memcpy(dp->name, name, namelen + 1);
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Re: [PATCH] cross-localedef-native : fixup filesystem check error
  2025-02-13  7:51 ` Khem Raj
@ 2025-02-13  9:48   ` 袁晓峰
  0 siblings, 0 replies; 3+ messages in thread
From: 袁晓峰 @ 2025-02-13  9:48 UTC (permalink / raw)
  To: Khem Raj; +Cc: openembedded-core, Jason Wessel

Hi Khem,
     I'm glad to do the format and PR. But I need some help. 
This is my first time submitting a patch, and my English is not very good, 
so I might have made some mistakes, but I'm not sure.
     I read https://docs.yoctoproject.org/dev/contributor-guide/recipe-style-guide.html
and https://docs.yoctoproject.org/dev/contributor-guide/submit-changes.html#sending-the-patches-via-email 
to do the format wok,  and do the pacthset test. So can you tell me more details, or give me some Introduction Page 
to help do the format work. 
    And I can read section 4.6 of https://docs.yoctoproject.org/dev/contributor-guide/submit-changes.html#sending-the-patches-via-email to create a PR on github for cross-localedef. I'm right?  
                      Thanks!
     

> -----原始邮件-----
> 发件人: "Khem Raj" <raj.khem@gmail.com>
> 发送时间:2025-02-13 15:51:13 (星期四)
> 收件人: "Xiaofeng Yuan" <yuanxiaofeng@eswincomputing.com>
> 抄送: openembedded-core@lists.openembedded.org, "Jason Wessel" <jason.wessel@windriver.com>
> 主题: Re: [PATCH] cross-localedef-native : fixup filesystem check error
> 
> Can you format the patch to match the style and also create a PR on
> githut for cross-localedef?
> 
> On Wed, Feb 12, 2025 at 10:42 PM Xiaofeng Yuan
> <yuanxiaofeng@eswincomputing.com> wrote:
> >
> > compile glibc-locale triger error, the error info
> > is "cross-localedef-native: /xxx/glibc-locale/2.40+git/
> > locale-tree/Makefile is on different filesystem than rest
> > (use -f option to override)." But check the file, find it's
> > filesystem is same as the rest. Now use the f_type instead of
> > dev_t to check the filesystem.
> >
> > Change-Id: I62d840dd74467e8e1afd6e322b05ce012d35458c
> >
> > Signed-off-by: Xiaofeng Yuan <yuanxiaofeng@eswincomputing.com>
> >
> > CC: Jason Wessel <jason.wessel@windriver.com>
> > CC: Khem Raj <raj.khem@gmail.com>
> > Change-Id: I0cf8f143dc4a38fc1835439f4d5e7641832b7a81
> > ---
> >  .../glibc/cross-localedef-native_2.40.bb      |  1 +
> >  ...ixup-hardlink-filesystem-check-error.patch | 78 +++++++++++++++++++
> >  2 files changed, 79 insertions(+)
> >  create mode 100644 meta/recipes-core/glibc/glibc/0001-localedef-fixup-hardlink-filesystem-check-error.patch
> >
> > diff --git a/meta/recipes-core/glibc/cross-localedef-native_2.40.bb b/meta/recipes-core/glibc/cross-localedef-native_2.40.bb
> > index fed6e4ea97..15204f3744 100644
> > --- a/meta/recipes-core/glibc/cross-localedef-native_2.40.bb
> > +++ b/meta/recipes-core/glibc/cross-localedef-native_2.40.bb
> > @@ -32,6 +32,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
> >             file://0014-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \
> >             file://0017-Replace-echo-with-printf-builtin-in-nscd-init-script.patch \
> >             file://0019-timezone-Make-shell-interpreter-overridable-in-tzsel.patch \
> > +           file://0001-localedef-fixup-hardlink-filesystem-check-error.patch \
> >             "
> >  # Makes for a rather long rev (22 characters), but...
> >  #
> > diff --git a/meta/recipes-core/glibc/glibc/0001-localedef-fixup-hardlink-filesystem-check-error.patch b/meta/recipes-core/glibc/glibc/0001-localedef-fixup-hardlink-filesystem-check-error.patch
> > new file mode 100644
> > index 0000000000..a7b3e01259
> > --- /dev/null
> > +++ b/meta/recipes-core/glibc/glibc/0001-localedef-fixup-hardlink-filesystem-check-error.patch
> > @@ -0,0 +1,78 @@
> > +From af6fa1c52d1f83f7a16adf6fa6241269e0034b0b Mon Sep 17 00:00:00 2001
> > +From: Xiaofeng Yuan <yuanxiaofeng@eswincomputing.com>
> > +Date: Thu, 13 Feb 2025 11:46:59 +0800
> > +Subject: [PATCH] cross-localedef-native : fixup filesystem check error
> > +
> > +Since ordinary files and directories within the same
> > +directory but on the same filesystem may have different dev_t,
> > +using dev_t to determine whether files (including directories)
> > +belong to the same file system is unreliable and may lead to
> > +incorrect results. To address this issue, statfs is used to
> > +retrieve the filesystem information, allowing the determination
> > +of whether files belong to the same file system.
> > +
> > +Upstream-Status: Pending
> > +
> > +Signed-off-by: Xiaofeng Yuan <yuanxiaofeng@eswincomputing.com>
> > +---
> > + locale/programs/cross-localedef-hardlink.c | 32 +++++++++++++---------
> > + 1 file changed, 19 insertions(+), 13 deletions(-)
> > +
> > +diff --git a/locale/programs/cross-localedef-hardlink.c b/locale/programs/cross-localedef-hardlink.c
> > +index 726e6dd948..a51f076923 100644
> > +--- a/locale/programs/cross-localedef-hardlink.c
> > ++++ b/locale/programs/cross-localedef-hardlink.c
> > +@@ -42,6 +42,7 @@
> > + #include "xalloc.h"
> > + //#include "nls.h"
> > + //#include "closestream.h"
> > ++#include <sys/statfs.h>
> > +
> > + #define NHASH   (1<<17)  /* Must be a power of 2! */
> > + #define NBUF    64
> > +@@ -93,6 +94,7 @@ struct hardlink_ctl {
> > +               no_link:1,
> > +               content_only:1,
> > +               force:1;
> > ++      long f_type;
> > + };
> > + /* ctl is in global scope due use in atexit() */
> > + struct hardlink_ctl global_ctl;
> > +@@ -185,20 +187,24 @@ static void growstr(struct hardlink_dynstr *str, size_t newlen)
> > +
> > + static void process_path(struct hardlink_ctl *ctl, const char *name)
> > + {
> > +-      struct stat st, st2, st3;
> > +-      const size_t namelen = strlen(name);
> > ++        struct stat st, st2, st3;
> > ++        struct statfs stfs;
> > ++        const size_t namelen = strlen(name);
> > ++
> > ++        ctl->nobjects++;
> > ++        if (lstat(name, &st))
> > ++                return;
> > ++        if (statfs(name, &stfs))
> > ++                return;
> > ++
> > ++        if (stfs.f_type != ctl->f_type && !ctl->force) {
> > ++                if (ctl->f_type)
> > ++                        errx(EXIT_FAILURE,
> > ++                             ("%s is on different filesystem than the rest "
> > ++                               "(use -f option to override)."), name);
> > ++                ctl->f_type = stfs.f_type;
> > ++        }
> > +
> > +-      ctl->nobjects++;
> > +-      if (lstat(name, &st))
> > +-              return;
> > +-
> > +-      if (st.st_dev != ctl->dev && !ctl->force) {
> > +-              if (ctl->dev)
> > +-                      errx(EXIT_FAILURE,
> > +-                           ("%s is on different filesystem than the rest "
> > +-                             "(use -f option to override)."), name);
> > +-              ctl->dev = st.st_dev;
> > +-      }
> > +       if (S_ISDIR(st.st_mode)) {
> > +               struct hardlink_dir *dp = xmalloc(add3(sizeof(*dp), namelen, 1));
> > +               memcpy(dp->name, name, namelen + 1);
> >

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-02-13  9:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-13  6:42 [PATCH] cross-localedef-native : fixup filesystem check error Xiaofeng Yuan
2025-02-13  7:51 ` Khem Raj
2025-02-13  9:48   ` 袁晓峰

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.