[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Permissions at creating directory

Kless

10/14/2008 4:05:00 PM

Why a new directory is ignoring my permissions?

Dir.mkdir('foo', 711)

It's created with 755, the permissions by deafult of my system. My
umask is to 0022.
5 Answers

Michael Monaghan

10/14/2008 6:15:00 PM

0

[Note: parts of this message were removed to make it a legal post.]

Instead of 711, try 0711.

~mm

On Tue, Oct 14, 2008 at 12:05 PM, Kless <jonas.esp@googlemail.com> wrote:

> Why a new directory is ignoring my permissions?
>
> Dir.mkdir('foo', 711)
>
> It's created with 755, the permissions by deafult of my system. My
> umask is to 0022.
>
>

Kless

10/14/2008 6:48:00 PM

0

On 14 oct, 19:14, Michael Monaghan <mick...@gmail.com> wrote:
> Instead of 711, try 0711.
I had tried too as with 0700 but nothing.

Brian Candler

10/15/2008 8:38:00 AM

0

Kless wrote:
> Why a new directory is ignoring my permissions?
>
> Dir.mkdir('foo', 711)
>
> It's created with 755, the permissions by deafult of my system. My
> umask is to 0022.

So what's "your system"? (i.e. OS and Ruby version)

It Works For Me [TM]. This is Ubuntu Dapper with its default Ruby:

irb(main):001:0> RUBY_VERSION
=> "1.8.4"
irb(main):002:0> "%o" % File.umask
=> "22"
irb(main):003:0> Dir.mkdir "foo1"
=> 0
irb(main):004:0> `ls -ld foo1`
=> "drwxr-xr-x 2 candlerb candlerb 4096 2008-10-15 09:31 foo1\n"
irb(main):005:0> Dir.mkdir "foo2", 0700
=> 0
irb(main):006:0> `ls -ld foo2`
=> "drwx------ 2 candlerb candlerb 4096 2008-10-15 09:31 foo2\n"
irb(main):007:0>

but I get the same with 1.8.6p114 built from source under Ubuntu Hardy.

What happens if you try to chmod the directory after creating it? What
filesystem are you trying to create this directory in?

If you have a Linux box but are creating files in a mounted MS-DOS
filesystem (typically the case for a memory stick) then you'll get the
same Unix mode bits for everything, as the filesystem doesn't store
them.

HTH,

Brian.
--
Posted via http://www.ruby-....

Kless

10/15/2008 2:15:00 PM

0

On 15 oct, 09:37, Brian Candler <b.cand...@pobox.com> wrote:
> Kless wrote:
> > Why a new directory is ignoring my permissions?
>
> > Dir.mkdir('foo', 711)
>
> > It's created with 755, the permissions by deafult of my system. My
> > umask is to 0022.
>
> So what's "your system"? (i.e. OS and Ruby version)
>
> It Works For Me [TM]. This is Ubuntu Dapper with its default Ruby:
>
> irb(main):001:0> RUBY_VERSION
> => "1.8.4"
> irb(main):002:0> "%o" % File.umask
> => "22"
> irb(main):003:0> Dir.mkdir "foo1"
> => 0
> irb(main):004:0> `ls -ld foo1`
> => "drwxr-xr-x 2 candlerb candlerb 4096 2008-10-15 09:31 foo1\n"
> irb(main):005:0> Dir.mkdir "foo2", 0700
> => 0
> irb(main):006:0> `ls -ld foo2`
> => "drwx------ 2 candlerb candlerb 4096 2008-10-15 09:31 foo2\n"
> irb(main):007:0>
>
> but I get the same with 1.8.6p114 built from source under Ubuntu Hardy.
>
> What happens if you try to chmod the directory after creating it? What
> filesystem are you trying to create this directory in?
>
> If you have a Linux box but are creating files in a mounted MS-DOS
> filesystem (typically the case for a memory stick) then you'll get the
> same Unix mode bits for everything, as the filesystem doesn't store
> them.
>
> HTH,
>
> Brian.
> --
> Posted viahttp://www.ruby-....

Thanks! You gave me the idea.

The problem is that I'm trying to create a subdirectory, anything as
'./foo/bar'. If it's tryed in irb, it gives a failure.

But I was calling it since a JRuby program where it's created
correctly except for the mode.

John Doe

4/20/2014 12:42:00 AM

0

Bob(but not THAT Bob) wrote:
>
> RichA wrote:
> >
> > On Saturday, April 19, 2014 5:58:18 PM UTC-4, RichA wrote:
> > > Does anyone think and ep. of "
> >
> > Sorry. Does anyone think an ep. of "Blue Bloods" or "The Good Wife" has the same acting or writing quality of "The Americans" or "True Detective?" Of course not. And this brings up an interesting thing, in that it seems it's harder to write good-quality dialog and wring good acting out of people in PG-rated, network TV programs. I'm not sure why this is the case, but IMO, it is.
>
> I was stuck in front of a TV playing Blue Bloods for the whole hour last
> week, and I've had root canals that went by less painlessly.
>

that's "less painfully" or "more painlessly" - don't type drunk, kids!