From: Eric Sandeen <sandeen@sandeen.net>
To: xfs-oss <xfs@oss.sgi.com>
Subject: [PATCH V2] xfstests: use stat not lstat when examining devices
Date: Fri, 04 Jun 2010 12:36:57 -0500 [thread overview]
Message-ID: <4C0939B9.9000109@sandeen.net> (raw)
In-Reply-To: <4C091B4E.5030503@sandeen.net>
If you try running xfstests on lvm volumes which are symlinks,
it'll fail to run several tests because our _require_scratch
framework ultimately uses lstat not stat, and does not think
the lvm device (which is usually a symlink to a dm-X device)
is a block device. Sigh.
Adding a -l option to lstat64 in order to call stat not lstat,
and stat the target of the link, should be a simple fix.
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---
diff --git a/common.rc b/common.rc
index 6bf1e12..3539a43 100644
--- a/common.rc
+++ b/common.rc
@@ -584,7 +584,7 @@ _is_block_dev()
exit 1
fi
- [ -b $1 ] && src/lstat64 $1 | $AWK_PROG '/Device type:/ { print $9 }'
+ [ -b $1 ] && src/lstat64 -l $1 | $AWK_PROG '/Device type:/ { print $9 }'
}
# Do a command, log it to $seq.full, optionally test return status
diff --git a/src/lstat64.c b/src/lstat64.c
index 3b68c66..c7c7106 100644
--- a/src/lstat64.c
+++ b/src/lstat64.c
@@ -49,7 +49,7 @@ timesince(long timesec)
void
usage(void)
{
- fprintf(stderr, "Usage: lstat64 [-t] filename ...\n");
+ fprintf(stderr, "Usage: lstat64 [-tl] filename ...\n");
exit(1);
}
@@ -59,13 +59,18 @@ main(int argc, char **argv)
struct stat64 sbuf;
int i, c;
int terse_flag = 0;
+ int follow_flag = 0;
- while ((c = getopt(argc, argv, "t")) != EOF) {
+ while ((c = getopt(argc, argv, "tl")) != EOF) {
switch (c) {
case 't':
terse_flag = 1;
break;
+ case 'l':
+ follow_flag = 1;
+ break;
+
case '?':
usage();
}
@@ -79,7 +84,10 @@ main(int argc, char **argv)
for (i = optind; i < argc; i++) {
char mode[] = "----------";
- if( lstat64(argv[i], &sbuf) < 0) {
+ if (!follow_flag && lstat64(argv[i], &sbuf) < 0) {
+ perror(argv[i]);
+ continue;
+ } else if (follow_flag && stat64(argv[i], &sbuf) < 0) {
perror(argv[i]);
continue;
}
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2010-06-04 17:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-04 15:27 [PATCH] xfstests: use stat not lstat when examining devices Eric Sandeen
2010-06-04 17:36 ` Eric Sandeen [this message]
2010-06-04 18:00 ` [PATCH V3] " Eric Sandeen
2010-06-04 18:26 ` Alex Elder
2010-06-08 16:06 ` Eric Sandeen
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=4C0939B9.9000109@sandeen.net \
--to=sandeen@sandeen.net \
--cc=xfs@oss.sgi.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 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.