Pathnames followed by "..." when printed using printpathn

Zubin Mithra zubin.mithra at gmail.com
Wed May 28 16:41:17 UTC 2014


Hey Dmitry,

On Wed, May 28, 2014 at 10:01 PM, Dmitry V. Levin <ldv at altlinux.org> wrote:
> On Wed, May 28, 2014 at 08:12:05PM +0530, Zubin Mithra wrote:
>> Hello,
>>
>> >> (The current implementation is just a PoC and I haven't committed
>> anything
>> >> yet, I'll post a link to the commit as soon as I push it in.)
>> >
>> > This is your own repo, you can commit often!
>>
>> I've added in the code for converting all paths that are printed via
>> printpathn(hence, all paths via printpath too). Please find the code at [1].
>
> It would be more convenient to comment the code posted to the list, so I
> won't go into details, just write generic comments.

I'll post the code to the list in a few minutes.

>
> First, printing absolute paths is not the same as printing canonicalized
> paths.  The first is straightforward, the second is more complicated and
> may produce unexpected results.  For example, do you really want to follow
> symlinks when decoding path names passed to open(2)?

Hmm, yes. Ideally, we'd want resolution of "." and ".." alone, and not
symlinks but that wouldn't be possible. I'll change the code to
reflect absolute paths and not canonicalized ones.

>
> Second, readlink("/proc/%u/cwd") may fail for other reasons than
> ENAMETOOLONG, including ENOENT (either /proc is not mounted or the process
> has been killed).  If for whatever reason it returned a value <= 0, there
> is no way to convert a relative path to an absolute one.

I see -- in such cases, will printing the relative path suffice? Are
there any other methods for finding the tracee's cwd that I should
look into?


Thanks,
-- zm




More information about the Strace-devel mailing list