Chmod on Windoze

Rubies:

I'm aware the answer is "because MS Windows is inferior", and I certainly
have no intention of besmirching Ruby, but...

Why does File.chmod() only work on GNU / Un*x? Why does it punt on Windows?
Has someone fixed this since last I checked? Shelling to ATTRIB is icky.

CygWin doesn't have this >cough< problem...

···

--
  Phlip
  http://www.greencheese.org/ZeekLand <-- NOT a blog!!!

Phlip wrote:

Rubies:

I'm aware the answer is "because MS Windows is inferior", and I certainly
have no intention of besmirching Ruby, but...

Why does File.chmod() only work on GNU / Un*x? Why does it punt on Windows?
Has someone fixed this since last I checked? Shelling to ATTRIB is icky.

CygWin doesn't have this >cough< problem...

Why can't I do CreateProcess() on Unix? Windows doesn't have this
problem.

Seriously, MS Windows just doesn't do permissions the way Unix does,
though it does have the equivalent of ACL that most flavors of Unix
have. See win32-file if you want to tinker with it.

Oh, and actually, File.chmod *does* work on Windows...kinda. You can
use 0444 to make a file read-only, or 0644 to make it writeable (or
rather, to make it not read-only). You can do trickier things with
win32-file.

Regards,

Dan

Daniel Berger wrote:

Why can't I do CreateProcess() on Unix? Windows doesn't have this
problem.

I stopped reading here.

···

--
  Phlip
  greencheese.org <-- NOT a blog!!!

Your loss - he answered your question downstream.

martin

···

Phlip <phlipcpp@yahoo.com> wrote:

Daniel Berger wrote:

> Why can't I do CreateProcess() on Unix? Windows doesn't have this
> problem.

I stopped reading here.

Martin DeMello wrote:

···

Phlip <phlipcpp@yahoo.com> wrote:

Daniel Berger wrote:

Why can't I do CreateProcess() on Unix? Windows doesn't have this
problem.

I stopped reading here.

Your loss - he answered your question downstream.

I'd venture to guess that if someone is looking is looking for help with some tool or application or OS, using /. script-kiddie slang, such as "Windoze", or beginning a request for help by knocking the subject matter, is probably not the best way to encourage those who may know the answer to pitch in.

James

--

http://www.ruby-doc.org - The Ruby Documentation Site
http://www.rubyxml.com - News, Articles, and Listings for Ruby & XML
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com - Playing with Better Toys

James Britt wrote:

I'd venture to guess that if someone is looking is looking for help with
some tool or application or OS, using /. script-kiddie slang, such as
"Windoze", or beginning a request for help by knocking the subject matter,
is probably not the best way to encourage those who may know the answer to
pitch in.

So "you asked a stupid question, so you deserve to get flamed". Okay.

(For those curious about the actual topics, 0444 and 0644 started working,
so I don't know why historically they did not for me. And CreateProcess()
and fork() are sufficiently different that one should not be expected to
emulate the other...)

···

--
  Phlip
  greencheese.org <-- NOT a blog!!!

James Britt wrote:

I'd venture to guess that if someone is looking is looking for help with
some tool or application or OS, using /. script-kiddie slang, such as
"Windoze", or beginning a request for help by knocking the subject
matter,
is probably not the best way to encourage those who may know the answer
to
pitch in.

So "you asked a stupid question, so you deserve to get flamed". Okay.

(For those curious about the actual topics, 0444 and 0644 started working,
so I don't know why historically they did not for me. And CreateProcess()
and fork() are sufficiently different that one should not be expected to
emulate the other...)

--
  Phlip
  greencheese.org <-- NOT a blog!!!

But really though, thanks Daniel for your prompt, accurate (to the best of
_my_ knowledge) and sincere answer to a question that is difficult to ask
correctly, nevermind answer.

Can we flesh this out just a little bit more though? The impression that
I've always gotten is that it isn't really possible to map across from the
Unix permission mechanism to the one implemented on Windows. The bits
that you set when you chmod something don't really translate directly into
some of the more complex permissions that you can set on Windows systems,
right?

So I don't think that Ruby (or anybody else) can hope to have a permission
handling aspect that is both cross-platform and correct. Am I wrong?

Phlip wrote:

James Britt wrote:

I'd venture to guess that if someone is looking is looking for help with some tool or application or OS, using /. script-kiddie slang, such as "Windoze", or beginning a request for help by knocking the subject matter, is probably not the best way to encourage those who may know the answer to pitch in.

So "you asked a stupid question, so you deserve to get flamed". Okay.

Well, the question itself was a good one.

I spend a lot of time working on Windows, and have picked up assorted knowledge and tips, but I'm likely not going to be overly interested in sharing this info with someone who is dismissive of the platform right from the get-go. It suggests, perhaps incorrectly, that the questioner really isn't serious, and hasn't bothered to do some basic groundwork because the topic is beneath them.

For example, if I had a question about something on a Mac, and I asked questions about Crapintosh or Hackintosh or Crapple computers, I'd deserve to be ignored or flamed.

James

···

--

http://www.ruby-doc.org - The Ruby Documentation Site
http://www.rubyxml.com - News, Articles, and Listings for Ruby & XML
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com - Playing with Better Toys

ogilthorpe@davie.textdrive.com wrote:

<snip>

Can we flesh this out just a little bit more though? The impression that
I've always gotten is that it isn't really possible to map across from the
Unix permission mechanism to the one implemented on Windows. The bits
that you set when you chmod something don't really translate directly into
some of the more complex permissions that you can set on Windows systems,
right?

Correct. For whatever reason MS decided to support a limited form of
chmod where you could make a file read-only, which probably just calls
SetFileAttributes() behind the scenes. I'm not sure why they did this,
other than to try to be more *nix compatible. In the end I think it
just confuses people.

So I don't think that Ruby (or anybody else) can hope to have a permission
handling aspect that is both cross-platform and correct. Am I wrong?

No, you're not wrong.

Regards,

Dan

James Britt wrote:

For example, if I had a question about something on a Mac, and I asked
questions about Crapintosh or Hackintosh or Crapple computers, I'd deserve
to be ignored or flamed.

Mr Manners reminds the Gentle Poster that, given a choice between
undeservedly flaming MS or deservedly the topic of this newsgroup, the
original poster chose to make a joke of the dilemma...

Back on subject, MS didn't write File.chmod(). CygWin's chmod system
apparently covers this by leaping into the NTFS Access Control Lists. I'm
not claiming Ruby should bother; I just accidentally thought it was having
trouble with the read-only bit.

···

--
  Phlip
  greencheese.org <-- NOT a blog!!!