Rakefile under Cygwin: permission denied

The Rakefile

    task :default => ['foo/bar']

    directory 'foo'

    file 'foo/bar' => ['foo'] do
        sh 'touch foo/bar'
    end

fails if both the directory 'foo' and the file 'bar' within it exist.

    c:/cygwin/tmp/> rake
    (in c:/cygwin/tmp)
    rake aborted!
    Permission denied - foo
    c:/cygwin/tmp/>

As you can see from the command prompt, this is under Cygwin.

Am I doing something wrong?

Jim

···

--
Jim Menard, jimm@io.com, http://www.io.com/~jimm/
"Congratulations are in order for Tom Reid. He says he just found out he is
the winner of the 2021 Psychic of the Year award." -- Seen on slashdot

"Jim Menard" <jimm@io.com> schrieb im Newsbeitrag
news:16589.40362.469983.478717@io.com...

The Rakefile

    task :default => ['foo/bar']

    directory 'foo'

    file 'foo/bar' => ['foo'] do
        sh 'touch foo/bar'
    end

fails if both the directory 'foo' and the file 'bar' within it exist.

    c:/cygwin/tmp/> rake
    (in c:/cygwin/tmp)
    rake aborted!
    Permission denied - foo
    c:/cygwin/tmp/>

As you can see from the command prompt, this is under Cygwin.

Am I doing something wrong?

Did you verify that the commands work from the prompt? Otherwise I'd
suspect a permissions problem.

Regards

    robert

Robert Klemme writes:

Did you verify that the commands work from the prompt? Otherwise I'd
suspect a permissions problem.

This is Windows XP and my login has admin privileges: what permissions? :slight_smile:

Actually, what's failing is deep inside rake. Its "timestamp" method calls

  File.new(name.to_s).mtime

but the "File.new('foo/bar')" is what fails with the "permission denied"
error. When I do "ls -l" (I'm using Cygwin)

~> ls -l foo
total 0
-rw-rw-rw- 1 JMenard 5 0 Jun 14 09:32 bar
~> ls -l foo/bar
-rw-rw-rw- 1 JMenard 5 0 Jun 14 09:32 foo/bar

Jim

···

--
Jim Menard, jimm@io.com, http://www.io.com/~jimm/
"My parents just came back from a planet where the dominant lifeform
had no bilateral symmetry, and all I got was this stupid F-Shirt."
    -- .sig of Paul Archer

"Jim Menard" <jimm@io.com> schrieb im Newsbeitrag
news:16589.43202.849693.149995@io.com...

Robert Klemme writes:

> Did you verify that the commands work from the prompt? Otherwise I'd
> suspect a permissions problem.
>

This is Windows XP and my login has admin privileges: what permissions?

:slight_smile:

As far as I know the complicated rights management of Win / NTFS I suspect
it is possible to reject permissions even for admins. So, this is an
option... :slight_smile:

Actually, what's failing is deep inside rake. Its "timestamp" method

calls

Then maybe you should post a stack trace to aid in Rake debugging.

Kind regards

    robert

Hi,

At Mon, 14 Jun 2004 22:32:13 +0900,
Jim Menard wrote in [ruby-talk:103498]:

Actually, what's failing is deep inside rake. Its "timestamp" method calls

  File.new(name.to_s).mtime

Why it's not
  File.mtime(name)
or
  File.open(name){|f| f.mtime}
?

···

--
Nobu Nakada

Robert,

As far as I know the complicated rights management of Win / NTFS I suspect
it is possible to reject permissions even for admins. So, this is an
option... :slight_smile:

> Actually, what's failing is deep inside rake. Its "timestamp" method
calls

Then maybe you should post a stack trace to aid in Rake debugging.

Good point.

rake --trace
(in c:/jmenard)
** Invoke default (first_time)
rake aborted!
Permission denied - foo
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.3.2/lib/rake.rb:263:in `initialize'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.3.2/lib/rake.rb:263:in `new'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.3.2/lib/rake.rb:263:in `timestamp'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.3.2/lib/rake.rb:256:in `needed?'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.3.2/lib/rake.rb:256:in `collect'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.3.2/lib/rake.rb:256:in `needed?'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.3.2/lib/rake.rb:107:in `trace_flags'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.3.2/lib/rake.rb:95:in `invoke'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.3.2/lib/rake.rb:99:in `invoke'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.3.2/lib/rake.rb:99:in `each'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.3.2/lib/rake.rb:99:in `invoke'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.3.2/lib/rake.rb:862:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.3.2/lib/rake.rb:862:in `each'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.3.2/lib/rake.rb:862:in `run'
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.3.2/bin/rake:7
/ruby/bin/rake:12:in `load'
/ruby/bin/rake:12

Jim

···

--
Jim Menard, jimm@io.com, http://www.io.com/~jimm/
"I can picture in my mind a world without war, a world without hate. And I
can picture us attacking that world, because they'd never expect it."
    -- Jack Handey

nobu.nokada@softhome.net writes:

Hi,

At Mon, 14 Jun 2004 22:32:13 +0900,
Jim Menard wrote in [ruby-talk:103498]:
> Actually, what's failing is deep inside rake. Its "timestamp" method calls
>
> File.new(name.to_s).mtime

Why it's not
  File.mtime(name)
or
  File.open(name){|f| f.mtime}
?

I don't know why. File.mtime(name.to_s) works.

I've CC'd rake-devel. Consider this a change request: Please change the
implementation of timestamp to be

  File.mtime(name.to_s)

because under XP, the current implementation

  File.new(name.to_s).mtime

fails if name already exists due to a "ERRNO::EACCESS: Permission denied"
error.

Jim

···

--
Jim Menard, jimm@io.com, http://www.io.com/~jimm/
"Eating kittens is just plain ... plain wrong! And no one should do it, ever!"
    -- The Tick