summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/pseudo/files/0001-realpath.c-Remove-trailing-slashes.patch
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2020-06-26 11:47:12 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-06-28 08:36:00 +0100
commit9f5f3905007c59730e32fa72fcdbe41485c306c0 (patch)
treedc91228966be5d473b241a187578d03565a127a9 /meta/recipes-devtools/pseudo/files/0001-realpath.c-Remove-trailing-slashes.patch
parentc0a16eaae08edaa21c551947726b189a1afec1ae (diff)
downloadpoky-9f5f3905007c59730e32fa72fcdbe41485c306c0.tar.gz
pseudo: Switch to oe-core branch in git repo
We have a significant number of outstanding patches to pseudo. Rather than queue these up as patches, create a branch in the upstream repo and use that until such times as we have someone with the time/skills to properly review these for master in the pseudo repo. (From OE-Core rev: f09088eaa803ce396726368626a35dee70168d91) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/pseudo/files/0001-realpath.c-Remove-trailing-slashes.patch')
-rw-r--r--meta/recipes-devtools/pseudo/files/0001-realpath.c-Remove-trailing-slashes.patch57
1 files changed, 0 insertions, 57 deletions
diff --git a/meta/recipes-devtools/pseudo/files/0001-realpath.c-Remove-trailing-slashes.patch b/meta/recipes-devtools/pseudo/files/0001-realpath.c-Remove-trailing-slashes.patch
deleted file mode 100644
index 17829ef3ac..0000000000
--- a/meta/recipes-devtools/pseudo/files/0001-realpath.c-Remove-trailing-slashes.patch
+++ /dev/null
@@ -1,57 +0,0 @@
1From 86c9a5610e3333ad6aaadb1ac1e8b5a2c948d119 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Mon, 25 Nov 2019 18:46:45 +0800
4Subject: [PATCH] realpath.c: Remove trailing slashes
5
6Linux system's realpath() remove trailing slashes, but pseudo's doesn't, need
7make them identical.
8
9E.g., the following code (rel.c) prints '/tmp' with system's realpath, but
10pseudo's realpath prints '/tmp/':
11
12 #include <stdio.h>
13 #include <limits.h>
14 #include <stdlib.h>
15
16 int main() {
17 char out[PATH_MAX];
18 printf("%s\n", realpath("/tmp/", out));
19 return 0;
20 }
21
22$ bitbake base-passwd -cdevshell # For pseudo env
23$ gcc rel.c
24$ ./a.out
25/tmp/ (but should be /tmp)
26
27This patch fixes the problem.
28
29Upstream-Status: Submitted [https://lists.yoctoproject.org/g/poky/message/11879]
30
31Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
32---
33 ports/unix/guts/realpath.c | 9 ++++++++-
34 1 file changed, 8 insertions(+), 1 deletion(-)
35
36diff --git a/ports/unix/guts/realpath.c b/ports/unix/guts/realpath.c
37--- a/ports/unix/guts/realpath.c
38+++ b/ports/unix/guts/realpath.c
39@@ -14,7 +14,14 @@
40 errno = ENAMETOOLONG;
41 return NULL;
42 }
43- if ((len = strlen(rname)) >= pseudo_sys_path_max()) {
44+ len = strlen(rname);
45+ char *ep = rname + len - 1;
46+ while (ep > rname && *ep == '/') {
47+ --len;
48+ *(ep--) = '\0';
49+ }
50+
51+ if (len >= pseudo_sys_path_max()) {
52 errno = ENAMETOOLONG;
53 return NULL;
54 }
55--
562.7.4
57