All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] Add tst_tmpdir_path() and tst_tmpdir_mkpath()
Date: Wed, 24 Jul 2024 10:44:27 +0200	[thread overview]
Message-ID: <ZqC-69CoVPMRsJLv@yuki> (raw)
In-Reply-To: <20240724074247.GA924796@pevik>

Hi!
> > I had a strange SEGFAULT when .needs_tmpdir is not defined. Are you sure the
> > feature is correctly working in that case? TCONF should be expected in that
> > case.
> 
> Could you be more specific what is wrong? (failing test, what backtrace from gdb
> outputs. Maybe run it both *with* and *without* set follow-fork-mode child, not
> sure if the info will be in the library run or in the test fork run).
> 
> I tested bind02.c, which is *without* .needs_tmpdir and it works. bind01.c is
> *with* .needs_tmpdir and it also works.  These are not modified by the merged
> change (c5d95b6d3), thus I also tested chroot01.c (*without* .needs_tmpdir) and
> it also works.
> 
> Besides, openSUSE LTP testing of LTP syscalls with c5d95b6d3 [1] does not have
> any new failures.

I suppose that we need this, to have a TBROK message instead of SegFault
if users call things out of order:

diff --git a/lib/tst_tmpdir.c b/lib/tst_tmpdir.c
index 1fb1bd698..bbb45dfa9 100644
--- a/lib/tst_tmpdir.c
+++ b/lib/tst_tmpdir.c
@@ -358,6 +358,9 @@ char *tst_tmpdir_path(void)
 {
        static char *tmpdir;

+       if (!TESTDIR)
+               tst_brk(TBROK, ".needs_tmpdir must be set!");
+
        if (tmpdir)
                return tmpdir;

@@ -368,11 +371,16 @@ char *tst_tmpdir_path(void)

 char *tst_tmpdir_mkpath(const char *fmt, ...)
 {
-       size_t testdir_len = strlen(TESTDIR);
-       size_t path_len = testdir_len;
+       size_t testdir_len, path_len;
        va_list va, vac;
        char *ret;

+       if (!TESTDIR)
+               tst_brk(TBROK, ".needs_tmpdir must be set!");
+
+       testdir_len = strlen(TESTDIR);
+       path_len = testdir_len;
+
        va_start(va, fmt);
        va_copy(vac, va);
        path_len += vsnprintf(NULL, 0, fmt, va) + 2;


-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2024-07-24  8:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-12 13:44 [LTP] [PATCH] Add tst_tmpdir_path() and tst_tmpdir_mkpath() Cyril Hrubis
2024-07-17  8:25 ` Petr Vorel
2024-07-17  8:31   ` Petr Vorel
2024-07-22 13:06     ` Petr Vorel
2024-07-22 13:10       ` Cyril Hrubis
2024-07-23 15:17         ` Andrea Cervesato via ltp
2024-07-24  7:42           ` Petr Vorel
2024-07-24  8:44             ` Cyril Hrubis [this message]
2024-07-24  9:01               ` Andrea Cervesato via ltp
2024-07-24  9:05                 ` Petr Vorel
2024-07-17  8:33   ` Cyril Hrubis

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=ZqC-69CoVPMRsJLv@yuki \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=pvorel@suse.cz \
    /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 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.