Jeff Newmiller
2020-Feb-28 22:37 UTC
[R] file.access returning -1 for a file on remote Windows drive.
Dunno. They agree for me. Maybe look closer at all permissions via Windows File Manager? On February 28, 2020 2:06:34 PM PST, Sam Albers <tonightsthenight at gmail.com> wrote:>Some additional follow-up: > >> summary(file(remote_file, "rb"))$`can read` >[1] "yes" > >> summary(file(local_file, "rb"))$`can read` >[1] "yes" > >compared to: > >> file.access(local_file, 4) >local.R > 0 > >> file.access(remote_file, 4) >remote.R > -1 > >Can anyone think why file.access and file would be contradicting each >other? > >Sam > >On Fri, Feb 28, 2020 at 10:47 AM Sam Albers ><tonightsthenight at gmail.com> wrote: >> >> Hi there, >> >> Looking for some help in diagnosing or developing a work around to a >> problem I am having on a Windows machine. I am running R 3.6.2. >> >> I have two identical files, one stored locally and the other stored >on >> a network drive. >> >> For access: >> >> > file.access(local_file, 4) >> local.R >> 0 >> >> > file.access(remote_file, 4) >> remote.R >> -1 >> >> Also for file.info >> >> > file.info(local_file)$mode: >> [1] "666" >> >> > file.info(remote_file)$mode: >> [1] "666" >> >> Ok so I am access issues. Maybe they are ephemeral and I can change >> the permissions: >> >> > Sys.chmod('remote.R', mode = '666') >> > file.access(remote_file, 4) >> remote.R >> -1 >> >> Nope. I am thoroughly stumped and maybe can't make it any further >> because of Windows. >> >> Downstream I am trying to use digest::digest to create a hash but >> digest thinks we don't have permission because file.access is >failing. >> Any thoughts on how I can get file.access to return 0 for the >remote.R >> file? Any ideas? >> >> Thanks in advance, >> >> Sam > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.-- Sent from my phone. Please excuse my brevity.
Sam Albers
2020-Feb-28 22:53 UTC
[R] file.access returning -1 for a file on remote Windows drive.
Thanks Jeff. I am probably not explaining myself very well but my question under what circumstances would summary(file(remote_file, "rb"))$`can read` be different from: file.access(remote_file, 4) If my permissions were different across remote and local should that not be reflected in both of these functions? On Fri, Feb 28, 2020 at 2:37 PM Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:> > Dunno. They agree for me. Maybe look closer at all permissions via Windows File Manager? > > On February 28, 2020 2:06:34 PM PST, Sam Albers <tonightsthenight at gmail.com> wrote: > >Some additional follow-up: > > > >> summary(file(remote_file, "rb"))$`can read` > >[1] "yes" > > > >> summary(file(local_file, "rb"))$`can read` > >[1] "yes" > > > >compared to: > > > >> file.access(local_file, 4) > >local.R > > 0 > > > >> file.access(remote_file, 4) > >remote.R > > -1 > > > >Can anyone think why file.access and file would be contradicting each > >other? > > > >Sam > > > >On Fri, Feb 28, 2020 at 10:47 AM Sam Albers > ><tonightsthenight at gmail.com> wrote: > >> > >> Hi there, > >> > >> Looking for some help in diagnosing or developing a work around to a > >> problem I am having on a Windows machine. I am running R 3.6.2. > >> > >> I have two identical files, one stored locally and the other stored > >on > >> a network drive. > >> > >> For access: > >> > >> > file.access(local_file, 4) > >> local.R > >> 0 > >> > >> > file.access(remote_file, 4) > >> remote.R > >> -1 > >> > >> Also for file.info > >> > >> > file.info(local_file)$mode: > >> [1] "666" > >> > >> > file.info(remote_file)$mode: > >> [1] "666" > >> > >> Ok so I am access issues. Maybe they are ephemeral and I can change > >> the permissions: > >> > >> > Sys.chmod('remote.R', mode = '666') > >> > file.access(remote_file, 4) > >> remote.R > >> -1 > >> > >> Nope. I am thoroughly stumped and maybe can't make it any further > >> because of Windows. > >> > >> Downstream I am trying to use digest::digest to create a hash but > >> digest thinks we don't have permission because file.access is > >failing. > >> Any thoughts on how I can get file.access to return 0 for the > >remote.R > >> file? Any ideas? > >> > >> Thanks in advance, > >> > >> Sam > > > >______________________________________________ > >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > >https://stat.ethz.ch/mailman/listinfo/r-help > >PLEASE do read the posting guide > >http://www.R-project.org/posting-guide.html > >and provide commented, minimal, self-contained, reproducible code. > > -- > Sent from my phone. Please excuse my brevity.
Jeff Newmiller
2020-Feb-28 23:20 UTC
[R] file.access returning -1 for a file on remote Windows drive.
I don't know. Windows uses Access Control Lists, while POSIX (e.g. Linux) uses user/group/other classification. These two world views do not have a simple 1:1 correspondence, so you might see some difference between your file security configuration in the file properties. Then again there are some hints online that the problem is not new... there is a package called R.utils that may help. On February 28, 2020 2:53:49 PM PST, Sam Albers <tonightsthenight at gmail.com> wrote:>Thanks Jeff. I am probably not explaining myself very well but my >question under what circumstances would > >summary(file(remote_file, "rb"))$`can read` > >be different from: > >file.access(remote_file, 4) > >If my permissions were different across remote and local should that >not be reflected in both of these functions? > >On Fri, Feb 28, 2020 at 2:37 PM Jeff Newmiller ><jdnewmil at dcn.davis.ca.us> wrote: >> >> Dunno. They agree for me. Maybe look closer at all permissions via >Windows File Manager? >> >> On February 28, 2020 2:06:34 PM PST, Sam Albers ><tonightsthenight at gmail.com> wrote: >> >Some additional follow-up: >> > >> >> summary(file(remote_file, "rb"))$`can read` >> >[1] "yes" >> > >> >> summary(file(local_file, "rb"))$`can read` >> >[1] "yes" >> > >> >compared to: >> > >> >> file.access(local_file, 4) >> >local.R >> > 0 >> > >> >> file.access(remote_file, 4) >> >remote.R >> > -1 >> > >> >Can anyone think why file.access and file would be contradicting >each >> >other? >> > >> >Sam >> > >> >On Fri, Feb 28, 2020 at 10:47 AM Sam Albers >> ><tonightsthenight at gmail.com> wrote: >> >> >> >> Hi there, >> >> >> >> Looking for some help in diagnosing or developing a work around to >a >> >> problem I am having on a Windows machine. I am running R 3.6.2. >> >> >> >> I have two identical files, one stored locally and the other >stored >> >on >> >> a network drive. >> >> >> >> For access: >> >> >> >> > file.access(local_file, 4) >> >> local.R >> >> 0 >> >> >> >> > file.access(remote_file, 4) >> >> remote.R >> >> -1 >> >> >> >> Also for file.info >> >> >> >> > file.info(local_file)$mode: >> >> [1] "666" >> >> >> >> > file.info(remote_file)$mode: >> >> [1] "666" >> >> >> >> Ok so I am access issues. Maybe they are ephemeral and I can >change >> >> the permissions: >> >> >> >> > Sys.chmod('remote.R', mode = '666') >> >> > file.access(remote_file, 4) >> >> remote.R >> >> -1 >> >> >> >> Nope. I am thoroughly stumped and maybe can't make it any further >> >> because of Windows. >> >> >> >> Downstream I am trying to use digest::digest to create a hash but >> >> digest thinks we don't have permission because file.access is >> >failing. >> >> Any thoughts on how I can get file.access to return 0 for the >> >remote.R >> >> file? Any ideas? >> >> >> >> Thanks in advance, >> >> >> >> Sam >> > >> >______________________________________________ >> >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> >https://stat.ethz.ch/mailman/listinfo/r-help >> >PLEASE do read the posting guide >> >http://www.R-project.org/posting-guide.html >> >and provide commented, minimal, self-contained, reproducible code. >> >> -- >> Sent from my phone. Please excuse my brevity.-- Sent from my phone. Please excuse my brevity.
William Dunlap
2020-Feb-28 23:28 UTC
[R] file.access returning -1 for a file on remote Windows drive.
If file.access() says the file is unreadable but file() says it can be opened, why don't you just open the file and read it? You can use tryCatch to deal with problems opening or reading the file. Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Feb 28, 2020 at 2:54 PM Sam Albers <tonightsthenight at gmail.com> wrote:> Thanks Jeff. I am probably not explaining myself very well but my > question under what circumstances would > > summary(file(remote_file, "rb"))$`can read` > > be different from: > > file.access(remote_file, 4) > > If my permissions were different across remote and local should that > not be reflected in both of these functions? > > On Fri, Feb 28, 2020 at 2:37 PM Jeff Newmiller <jdnewmil at dcn.davis.ca.us> > wrote: > > > > Dunno. They agree for me. Maybe look closer at all permissions via > Windows File Manager? > > > > On February 28, 2020 2:06:34 PM PST, Sam Albers < > tonightsthenight at gmail.com> wrote: > > >Some additional follow-up: > > > > > >> summary(file(remote_file, "rb"))$`can read` > > >[1] "yes" > > > > > >> summary(file(local_file, "rb"))$`can read` > > >[1] "yes" > > > > > >compared to: > > > > > >> file.access(local_file, 4) > > >local.R > > > 0 > > > > > >> file.access(remote_file, 4) > > >remote.R > > > -1 > > > > > >Can anyone think why file.access and file would be contradicting each > > >other? > > > > > >Sam > > > > > >On Fri, Feb 28, 2020 at 10:47 AM Sam Albers > > ><tonightsthenight at gmail.com> wrote: > > >> > > >> Hi there, > > >> > > >> Looking for some help in diagnosing or developing a work around to a > > >> problem I am having on a Windows machine. I am running R 3.6.2. > > >> > > >> I have two identical files, one stored locally and the other stored > > >on > > >> a network drive. > > >> > > >> For access: > > >> > > >> > file.access(local_file, 4) > > >> local.R > > >> 0 > > >> > > >> > file.access(remote_file, 4) > > >> remote.R > > >> -1 > > >> > > >> Also for file.info > > >> > > >> > file.info(local_file)$mode: > > >> [1] "666" > > >> > > >> > file.info(remote_file)$mode: > > >> [1] "666" > > >> > > >> Ok so I am access issues. Maybe they are ephemeral and I can change > > >> the permissions: > > >> > > >> > Sys.chmod('remote.R', mode = '666') > > >> > file.access(remote_file, 4) > > >> remote.R > > >> -1 > > >> > > >> Nope. I am thoroughly stumped and maybe can't make it any further > > >> because of Windows. > > >> > > >> Downstream I am trying to use digest::digest to create a hash but > > >> digest thinks we don't have permission because file.access is > > >failing. > > >> Any thoughts on how I can get file.access to return 0 for the > > >remote.R > > >> file? Any ideas? > > >> > > >> Thanks in advance, > > >> > > >> Sam > > > > > >______________________________________________ > > >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > > >https://stat.ethz.ch/mailman/listinfo/r-help > > >PLEASE do read the posting guide > > >http://www.R-project.org/posting-guide.html > > >and provide commented, minimal, self-contained, reproducible code. > > > > -- > > Sent from my phone. Please excuse my brevity. > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]