public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Bernhard Voelker <mail@bernhard-voelker.de>
To: "util-linux@vger.kernel.org" <util-linux@vger.kernel.org>
Subject: blkid: exit code as non-root user, and segfault
Date: Sun, 09 Dec 2012 18:52:29 +0100	[thread overview]
Message-ID: <50C4CFDD.1070405@bernhard-voelker.de> (raw)

blkid returns 0 without output when running as non-root user
and when the cache /dev/.blkid.tab is not yet there:

  ./blkid /dev/sdb3 ; echo $?
  0

That's the strace:

  open("/dev/.blkid.tab", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
  access("/dev/sdb3", F_OK)               = 0
  stat("/dev/sdb3", {st_mode=S_IFBLK|0660, st_rdev=makedev(8, 19), ...}) = 0
  open("/dev/sdb3", O_RDONLY|O_CLOEXEC)   = -1 EACCES (Permission denied)
  stat("/dev/.blkid.tab", 0x7fff2b7cc990) = -1 ENOENT (No such file or directory)
  open("/dev/.blkid.tab", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 EACCES (Permission denied)
  close(1)                                = 0
  close(2)                                = 0
  exit_group(0)                           = ?

I'd have expected either an error message along with exit code 1,
or success with some useful output.

After the cache exists, it's fine:

  ./blkid  /dev/sdb3 ; echo $?
  /dev/sdb3: LABEL="home" UUID="41ec7daa-46c3-4f19-aea0-e2c1679bb557" TYPE="ext3"
  0


And another issue: blkid segfaults with this - okay, bad use of options:

  ./blkid -n /dev/sdb3
  Segmentation fault

Backtrace:
  (gdb) bt
  #0  0x00007ff64fe72121 in __strlen_sse2 () from /lib64/libc.so.6
  #1  0x00007ff65039029b in blkid_dev_set_search (iter=0x6090c0, search_type=0x0, search_value=0x0) at
libblkid/src/dev.c:151
  #2  0x00000000004036e8 in main (argc=<optimized out>, argv=<optimized out>) at misc-utils/blkid.c:925

Using latest git; it doesn't dump core with 2.20.1.

Have a nice day,
Berny

             reply	other threads:[~2012-12-09 17:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-09 17:52 Bernhard Voelker [this message]
2012-12-10  8:42 ` blkid: exit code as non-root user, and segfault Karel Zak
2012-12-10  8:58   ` Bernhard Voelker
2012-12-10  9:11     ` Karel Zak
2012-12-10 11:49 ` Karel Zak

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=50C4CFDD.1070405@bernhard-voelker.de \
    --to=mail@bernhard-voelker.de \
    --cc=util-linux@vger.kernel.org \
    /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