All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [Bug 1813307] [NEW] util/path.c/follow_path() does not handle "/" well
@ 2019-01-25 14:17 Christophe Lyon
  2021-05-05 11:11 ` [Bug 1813307] " Thomas Huth
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe Lyon @ 2019-01-25 14:17 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

Hello,

I noticed that qemu does not handle "/" very well in follow_path().

Specifically, I was trying to run gdbserver under qemu, and it failed
inside its implementation of __getcwd.

Indeed it does something like
  if (__lstat ("/", &st) < 0)
.....
and then loops from current dir toward the top using lstat("..")

On qemu side, lstat forwards the request to follow_path() in util/path.c, and when passed "/", it returns the path in QEMU_LD_PREFIX (which was the top of my sysroot).
OTHT, the series of lstat("..") finally reaches the real device root because it's not recognized as "/" in follow_path(), so this is inconsistent and __getcwd fails.

I suppose there's a good reason for returning QEMU_LD_PREFIX when asking
for "/", but why is it so?

If there's no good reason, maybe the behaviour could be changed to map
"/" to "/" ?

Thanks

** Affects: qemu
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1813307

Title:
  util/path.c/follow_path() does not handle "/" well

Status in QEMU:
  New

Bug description:
  Hello,

  I noticed that qemu does not handle "/" very well in follow_path().

  Specifically, I was trying to run gdbserver under qemu, and it failed
  inside its implementation of __getcwd.

  Indeed it does something like
    if (__lstat ("/", &st) < 0)
  .....
  and then loops from current dir toward the top using lstat("..")

  On qemu side, lstat forwards the request to follow_path() in util/path.c, and when passed "/", it returns the path in QEMU_LD_PREFIX (which was the top of my sysroot).
  OTHT, the series of lstat("..") finally reaches the real device root because it's not recognized as "/" in follow_path(), so this is inconsistent and __getcwd fails.

  I suppose there's a good reason for returning QEMU_LD_PREFIX when
  asking for "/", but why is it so?

  If there's no good reason, maybe the behaviour could be changed to map
  "/" to "/" ?

  Thanks

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1813307/+subscriptions

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug 1813307] Re: util/path.c/follow_path() does not handle "/" well
  2019-01-25 14:17 [Qemu-devel] [Bug 1813307] [NEW] util/path.c/follow_path() does not handle "/" well Christophe Lyon
@ 2021-05-05 11:11 ` Thomas Huth
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Huth @ 2021-05-05 11:11 UTC (permalink / raw)
  To: qemu-devel

This is an automated cleanup. This bug report has been moved to QEMU's
new bug tracker on gitlab.com and thus gets marked as 'expired' now.
Please continue with the discussion here:

 https://gitlab.com/qemu-project/qemu/-/issues/162


** Changed in: qemu
       Status: New => Expired

** Bug watch added: gitlab.com/qemu-project/qemu/-/issues #162
   https://gitlab.com/qemu-project/qemu/-/issues/162

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1813307

Title:
  util/path.c/follow_path() does not handle "/" well

Status in QEMU:
  Expired

Bug description:
  Hello,

  I noticed that qemu does not handle "/" very well in follow_path().

  Specifically, I was trying to run gdbserver under qemu, and it failed
  inside its implementation of __getcwd.

  Indeed it does something like
    if (__lstat ("/", &st) < 0)
  .....
  and then loops from current dir toward the top using lstat("..")

  On qemu side, lstat forwards the request to follow_path() in util/path.c, and when passed "/", it returns the path in QEMU_LD_PREFIX (which was the top of my sysroot).
  OTHT, the series of lstat("..") finally reaches the real device root because it's not recognized as "/" in follow_path(), so this is inconsistent and __getcwd fails.

  I suppose there's a good reason for returning QEMU_LD_PREFIX when
  asking for "/", but why is it so?

  If there's no good reason, maybe the behaviour could be changed to map
  "/" to "/" ?

  Thanks

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1813307/+subscriptions


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-05 11:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-25 14:17 [Qemu-devel] [Bug 1813307] [NEW] util/path.c/follow_path() does not handle "/" well Christophe Lyon
2021-05-05 11:11 ` [Bug 1813307] " Thomas Huth

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.