From: Petr Vorel <pvorel@suse.cz>
To: Mengchi Cheng <mengcc@amazon.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v1] rwtest: Confirm df is a symlink to busybox
Date: Fri, 1 Dec 2023 09:22:43 +0100 [thread overview]
Message-ID: <20231201082243.GA1710028@pevik> (raw)
In-Reply-To: <20231130221522.689680-1-mengcc@amazon.com>
> On Thu, 2023-11-30 10:41:27 +0000, Petr Vorel wrote:
> > Hi Mengchi,
> > > /bin/df can be a symlink to coreutils. It returns correct info with dir
> > > arguments.
> > > Just checking if df is a symlink will include such cases. Need to make
> > > sure it is linking to busybox before ignoring options.
> > > Signed-off-by: Mengchi Cheng <mengcc@amazon.com>
> > > ---
> > > testcases/kernel/fs/doio/rwtest | 8 ++++----
> > > 1 file changed, 4 insertions(+), 4 deletions(-)
> > > diff --git a/testcases/kernel/fs/doio/rwtest b/testcases/kernel/fs/doio/rwtest
> > > index 6725e1426..26659e9d3 100644
> > > --- a/testcases/kernel/fs/doio/rwtest
> > > +++ b/testcases/kernel/fs/doio/rwtest
> > > @@ -329,10 +329,10 @@ do
> > > else
> > > # If df is a symlink (to busybox) then do not pass the $dir and $dfOpts
> > > # parameters because they don't work as expected
> > > - if test -h $(which df)
> > > - then
> > > - dir=""; dfOpts="";
> > > - fi
> > > + if [[ "$(readlink -f "$(which df)")" == *"busybox"* ]]
> > Could you please test if this works?
> > if [ "$(readlink -f "$(which df)")" = "busybox" ]
> I just replaced df with a symlink cmd and the string such as zstdmt/zstd in ubuntu.
> It does not work..
> But below should work
> if echo "$(readlink -f "$(which df)")" | grep -q "busybox"
Yes, this would work, but this would be better:
if df --version 2>&1 | grep -q 'BusyBox'
this is way simpler and this detection is already used elsewhere.
BTW how can happen that df is symlink on coreutils?
They provide a binary, right?
> However, I linked df to /bin/busybox on my device, df -P ${dir} seems fine.
> The original code may be for a very old version of busybox.
> :/# ls -l /bin/df
> lrwxrwxrwx 1 root root 12 2023-11-16 17:49 /bin/df -> /bin/busybox
> :/# df -P tmp
> Filesystem 1024-blocks Used Available Capacity Mounted on
> tmpfs 280848 4 280844 0% /tmp
> :/# /usr/bin/df.coreutils -P tmp
> Filesystem 1024-blocks Used Available Capacity Mounted on
> tmpfs 280848 4 280844 1% /tmp
> My busybox version is v1.35.0. It might be ok to remove the check completely.
-P was implemented in 2008
https://github.com/mirror/busybox/commit/d66aa3c701ffb83343239e71a8b294407ff5df86
BusyBox has often some features configurable (feature can be disabled), but if I
look correctly -P is not guarded to any config option
https://github.com/mirror/busybox/blob/master/coreutils/df.c
Therefore I'm for removing this option entirely. Please send v2.
Kind regards,
Petr
> Best,
> Mengchi
--
Mailing list info: https://lists.linux.it/listinfo/ltp
prev parent reply other threads:[~2023-12-01 8:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-30 0:40 [LTP] [PATCH v1] rwtest: Confirm df is a symlink to busybox Mengchi Cheng via ltp
2023-11-30 10:41 ` Petr Vorel
2023-11-30 10:53 ` Petr Vorel
2023-11-30 22:15 ` Mengchi Cheng via ltp
2023-12-01 8:22 ` Petr Vorel [this message]
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=20231201082243.GA1710028@pevik \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
--cc=mengcc@amazon.com \
/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