From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x332.google.com (mail-ot1-x332.google.com [IPv6:2607:f8b0:4864:20::332]) by sourceware.org (Postfix) with ESMTPS id BBC56384A87C for ; Thu, 11 Mar 2021 20:39:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BBC56384A87C Received: by mail-ot1-x332.google.com with SMTP id p24so2469771ota.11 for ; Thu, 11 Mar 2021 12:39:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UlrdmsvGpZbBLbyfmXzQtKyZ/qD/Yp/oGWjo+V6ARrI=; b=Akkjo+KB8FkDydyBELO/NYo1S+xtdL51VjeFjsVl/Zp249htQ3QVA3fBCplT0+Cc/x KHVxko+fQAfX+jN62P+oSJNaD7fejoVNfsAhImILSnE/43L8bLfmNH1I0dtGFTzfkFY1 sUjdFXcDckMdtcoZ8fdr2ssIDLOuve/72EU415iouK5CRWJ7gK/ePWty0QvaUEgMQ9Q0 BatuxbrCuKFsB2RMJ0qiQoJ1buVpW41kju6nMZdPHYxj8RmNig86mAfK3mVSGXMLm5ad vtcOzZ+YKh+ws1EenzUnZaEL7Tx6BgpJBK1pboE/flF+1UcIFtamRUmnIlHcQuOHPyUF GRtg== X-Gm-Message-State: AOAM5312LZM1IO91F0Ieblew7UA55+CUGQaxhrw8LYWlgJIkl8t0G28k icrbU8ffvU247pcpQXncrKTwti99SWmnpPG4YCz/jaj5 X-Google-Smtp-Source: ABdhPJzfmUCcjA90+PUru212PQ3UzuN1UTrW6Ln22rfn5Ho/acadXjtipUqncV1Ic9LyiXrG217Un8/O3pa5MdvdehE= X-Received: by 2002:a05:6830:1515:: with SMTP id k21mr610960otp.269.1615495180095; Thu, 11 Mar 2021 12:39:40 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: "H.J. Lu" Date: Thu, 11 Mar 2021 12:39:04 -0800 Message-ID: Subject: Re: [PATCH v1] test-container: Always copy test-specific support files [BZ #27537] To: DJ Delorie Cc: GNU C Library Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3036.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2021 20:39:42 -0000 On Thu, Mar 11, 2021 at 11:03 AM DJ Delorie via Libc-alpha wrote: > > > There's a small chance that a fresh checkout will result in some of > the test-specific container files will have the same timestamp and > size, which breaks the rsync logic in test-container, resulting in > tests running with the wrong support files. > > This patch changes the rsync logic to always copy the test-specific > files, which normally would always be copied anyway. The rsync logic > for the testroot itself is unchanged. > --- > support/test-container.c | 23 ++++++++++++----------- > 1 file changed, 12 insertions(+), 11 deletions(-) > > diff --git a/support/test-container.c b/support/test-container.c > index 28cc44d9f1..94498d3901 100644 > --- a/support/test-container.c > +++ b/support/test-container.c > @@ -481,7 +481,7 @@ need_sync (char *ap, char *bp, struct stat *a, struct stat *b) > } > > static void > -rsync_1 (path_buf * src, path_buf * dest, int and_delete) > +rsync_1 (path_buf * src, path_buf * dest, int and_delete, int force_copies) > { > DIR *dir; > struct dirent *de; > @@ -491,8 +491,9 @@ rsync_1 (path_buf * src, path_buf * dest, int and_delete) > r_append ("/", dest); > > if (verbose) > - printf ("sync %s to %s %s\n", src->buf, dest->buf, > - and_delete ? "and delete" : ""); > + printf ("sync %s to %s%s%s\n", src->buf, dest->buf, > + and_delete ? " and delete" : "", > + force_copies ? " (forced)" : ""); > > size_t staillen = src->len; > > @@ -521,10 +522,10 @@ rsync_1 (path_buf * src, path_buf * dest, int and_delete) > missing. */ > lstat (dest->buf, &d); > > - if (! need_sync (src->buf, dest->buf, &s, &d)) > + if (! force_copies && ! need_sync (src->buf, dest->buf, &s, &d)) > { > if (S_ISDIR (s.st_mode)) > - rsync_1 (src, dest, and_delete); > + rsync_1 (src, dest, and_delete, force_copies); > continue; > } > > @@ -559,7 +560,7 @@ rsync_1 (path_buf * src, path_buf * dest, int and_delete) > if (verbose) > printf ("+D %s\n", dest->buf); > maybe_xmkdir (dest->buf, (s.st_mode & 0777) | 0700); > - rsync_1 (src, dest, and_delete); > + rsync_1 (src, dest, and_delete, force_copies); > break; > > case S_IFLNK: > @@ -639,12 +640,12 @@ rsync_1 (path_buf * src, path_buf * dest, int and_delete) > } > > static void > -rsync (char *src, char *dest, int and_delete) > +rsync (char *src, char *dest, int and_delete, int force_copies) > { > r_setup (src, &spath); > r_setup (dest, &dpath); > > - rsync_1 (&spath, &dpath, and_delete); > + rsync_1 (&spath, &dpath, and_delete, force_copies); > } > > > @@ -846,11 +847,11 @@ main (int argc, char **argv) > do_ldconfig = true; > > rsync (pristine_root_path, new_root_path, > - file_exists (concat (command_root, "/preclean.req", NULL))); > + file_exists (concat (command_root, "/preclean.req", NULL)), 0); > > if (stat (command_root, &st) >= 0 > && S_ISDIR (st.st_mode)) > - rsync (command_root, new_root_path, 0); > + rsync (command_root, new_root_path, 0, 1); > > new_objdir_path = xstrdup (concat (new_root_path, > support_objdir_root, NULL)); > @@ -1044,7 +1045,7 @@ main (int argc, char **argv) > > /* Child has exited, we can post-clean the test root. */ > printf("running post-clean rsync\n"); > - rsync (pristine_root_path, new_root_path, 1); > + rsync (pristine_root_path, new_root_path, 1, 0); > > if (WIFEXITED (status)) > exit (WEXITSTATUS (status)); > -- > 2.29.2 > LGTM. Thanks. -- H.J.