public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: "Randy MacLeod" <randy.macleod@windriver.com>
To: Joe Slater <joe.slater@windriver.com>,
	<openembedded-core@lists.openembedded.org>,
	Seebs <seebs@seebs.net>
Subject: Re: [oe-core][PATCH 1/1] pseudo: fix renaming to self
Date: Wed, 26 Aug 2020 16:04:39 -0400	[thread overview]
Message-ID: <ef96587f-41d7-d285-27e8-cd6f78737028@windriver.com> (raw)
In-Reply-To: <20200826185857.24292-2-joe.slater@windriver.com>


Add Seebs.

Joe,
How did you test this change?

../Randy

On 2020-08-26 2:58 p.m., Joe Slater wrote:
> Pseudo tests for an item being renamed to itself only after
> information about it has been deleted.  Move the test to before
> we change the database.
>
> Note that pseudo does not support renameat2(), but neither does
> glibc.
>
> Signed-off-by: Joe Slater <joe.slater@windriver.com>
> ---
>   .../pseudo/files/rename.patch                 | 73 +++++++++++++++++++
>   meta/recipes-devtools/pseudo/pseudo_git.bb    |  1 +
>   2 files changed, 74 insertions(+)
>   create mode 100644 meta/recipes-devtools/pseudo/files/rename.patch
>
> diff --git a/meta/recipes-devtools/pseudo/files/rename.patch b/meta/recipes-devtools/pseudo/files/rename.patch
> new file mode 100644
> index 0000000000..bc344db3b5
> --- /dev/null
> +++ b/meta/recipes-devtools/pseudo/files/rename.patch
> @@ -0,0 +1,73 @@
> +pseudo: fix renaming to self
> +
> +The pseudo rename guts test for an item being renamed to
> +itself, only after information about it has been deleted.
> +We move the test to before we play with the database.
> +
> +Note that pseudo does not support renameat2().
> +
> +Upstream-Status: Pending
> +
> +Signed-off-by: Joe Slater <joe.slater@windriver.com>
> +
> +
> +--- a/ports/unix/guts/rename.c
> ++++ b/ports/unix/guts/rename.c
> +@@ -29,6 +29,14 @@
> + 	newrc = base_lstat(newpath, &newbuf);
> + 	oldrc = base_lstat(oldpath, &oldbuf);
> +
> ++	/* nothing to do for a "rename" of a link to itself */
> ++	if (newrc != -1 && oldrc != -1 &&
> ++	    newbuf.st_dev == oldbuf.st_dev &&
> ++	    newbuf.st_ino == oldbuf.st_ino) {
> ++		pseudo_debug(PDBGF_OP, "rename: paths are the same\n");
> ++		return real_rename(oldpath, newpath);
> ++        }
> ++
> + 	errno = save_errno;
> +
> + 	/* newpath must be removed. */
> +@@ -58,12 +66,6 @@
> + 		return rc;
> + 	}
> + 	save_errno = errno;
> +-	/* nothing to do for a "rename" of a link to itself */
> +-	if (newrc != -1 && oldrc != -1 &&
> +-	    newbuf.st_dev == oldbuf.st_dev &&
> +-	    newbuf.st_ino == oldbuf.st_ino) {
> +-		return rc;
> +-        }
> +
> + 	/* rename(3) is not mv(1).  rename(file, dir) fails; you must provide
> + 	 * the corrected path yourself.  You can rename over a directory only
> +--- a/ports/unix/guts/renameat.c
> ++++ b/ports/unix/guts/renameat.c
> +@@ -41,6 +41,14 @@
> + 	newrc = base_fstatat(newdirfd, newpath, &newbuf, AT_SYMLINK_NOFOLLOW);
> + #endif
> +
> ++	/* nothing to do for a "rename" of a link to itself */
> ++	if (newrc != -1 && oldrc != -1 &&
> ++	    newbuf.st_dev == oldbuf.st_dev &&
> ++	    newbuf.st_ino == oldbuf.st_ino) {
> ++		pseudo_debug(PDBGF_OP, "renameat: paths are the same\n");
> ++		return real_renameat(olddirfd, oldpath, newdirfd, newpath);
> ++        }
> ++
> + 	errno = save_errno;
> +
> + 	/* newpath must be removed. */
> +@@ -71,12 +79,6 @@
> + 		return rc;
> + 	}
> + 	save_errno = errno;
> +-	/* nothing to do for a "rename" of a link to itself */
> +-	if (newrc != -1 && oldrc != -1 &&
> +-	    newbuf.st_dev == oldbuf.st_dev &&
> +-	    newbuf.st_ino == oldbuf.st_ino) {
> +-		return rc;
> +-        }
> +
> + 	/* rename(3) is not mv(1).  rename(file, dir) fails; you must provide
> + 	 * the corrected path yourself.  You can rename over a directory only
> diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb
> index 9a22304bba..8d8cf8d523 100644
> --- a/meta/recipes-devtools/pseudo/pseudo_git.bb
> +++ b/meta/recipes-devtools/pseudo/pseudo_git.bb
> @@ -4,6 +4,7 @@ SRC_URI = "git://git.yoctoproject.org/pseudo;branch=oe-core \
>              file://0001-configure-Prune-PIE-flags.patch \
>              file://fallback-passwd \
>              file://fallback-group \
> +           file://rename.patch \
>              "
>   
>   SRCREV = "8efb082863ff0ceec7b7e46f9a44750e12f48039"


-- 
# Randy MacLeod
# Wind River Linux


  reply	other threads:[~2020-08-26 20:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-26 18:58 [oe-core][PATCH 0/1] pseudo - renaming to self Joe Slater
2020-08-26 18:58 ` [oe-core][PATCH 1/1] pseudo: fix " Joe Slater
2020-08-26 20:04   ` Randy MacLeod [this message]
2020-08-26 21:01     ` Randy MacLeod
2020-08-26 23:26     ` Joe Slater
2020-08-26 21:05   ` Richard Purdie

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=ef96587f-41d7-d285-27e8-cd6f78737028@windriver.com \
    --to=randy.macleod@windriver.com \
    --cc=joe.slater@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=seebs@seebs.net \
    /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