From karl.forner at gmail.com  Tue Oct 18 16:47:27 2016
From: karl.forner at gmail.com (Karl Forner)
Date: Tue, 18 Oct 2016 16:47:27 +0200
Subject: [Rd] weird dir() behavior with broken symlinks
In-Reply-To: <CAMd4_AewVAk4FEG0LfkdgjZuPRjYESxLWmkfviNS2RtJRKVE5g@mail.gmail.com>
References: <CAMd4_AewVAk4FEG0LfkdgjZuPRjYESxLWmkfviNS2RtJRKVE5g@mail.gmail.com>
Message-ID: <CAMd4_AdG-mW=GYTSwHVqUQ-nyrPosUX=2kTx-L=F9F4ZLi0rBQ@mail.gmail.com>

another strange behavior of list.dirs(), that seems related:
docker run -ti rocker/r-base

> setwd(tempdir())
> file.symlink('from', 'to')
[1] TRUE
> list.dirs(recursive=FALSE)
[1] "./to"

> file.symlink('C/non_existing.doc', 'broken.txt')
[1] TRUE
> list.dirs(recursive=FALSE)
[1] "./broken.txt"


On Tue, Oct 18, 2016 at 3:08 PM, Karl Forner <karl.forner at gmail.com> wrote:

> I encountered very weird behavior of the dir() function, that I just can
> not understand.
>
> Reproducible example:
>
> docker run -ti rocker/r-base
> R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
> Copyright (C) 2016 The R Foundation for Statistical Computing
> Platform: x86_64-pc-linux-gnu (64-bit)
> > # setup
> > tmp <- tempfile()
> > dir.create(tmp)
> > setwd(tmp)
> > file.symlink('from', 'to')
>
> # First weirdness, the behavior of the recursive argument
> > dir()
> [1] "to"
> > dir(recursive=TRUE)
> character(0)
>
> # include.dirs make it work again. The doc states: Should subdirectory
> names be included in
> #         recursive listings?  (They always are in non-recursive ones).
> >dir(recursive=TRUE, include.dirs=TRUE)
> [1] "to"
>
> Best,
> Karl
>
>
>

	[[alternative HTML version deleted]]



[Rd] weird dir() behavior with broken symlinks
Karl Forner