Re: [coreutils] RFC for adding file creation mode feature into touch uti (original) (raw)


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Rakib Mullick
Subject: Re: [coreutils] RFC for adding file creation mode feature into touch utility.
Date: Sat, 8 Jan 2011 12:44:23 +0600

On Sat, Jan 8, 2011 at 12:06 PM, Bob Proulx <address@hidden> wrote:

Rakib Mullick wrote: > Yes, right. Then, touch only supposed to change file's timestamp. No? > But, touch also creates a file for us. Not only it creates a file for > us, when it creates a file it takes reference from other files.

Yes.  That is what touch does.

> So, althrough we're in philosophy of one-tool-do-one-job-well, there > are something else that we can get.

What did you mean to say there?  That didn't parse for me.

Don't get me wrong. I do have full respect for this philosophy. I wanted to mean that, there are some extra functionality we often export for our good.

It is also to not duplicate functionality in every tool.  Otherwise every tool that creates files would need a --mode override.  That would definitely be too much.

I'm not sure how many tools out there for creating file (except those for creating special files, tmp files etc.). I think touch is mostly used for creating general purpose file and that is why I proposed to have touch this kind of option.

> And if adding --mode option to touch gets really out of philosophy, > then I think we need a new tool to for creating file with all the > options that we might have want. That will truly help us to keep the > philosophy intact.

No.  That doesn't follow at all.  The Unix philosophy isn't just that tools should do one thing and do it well but also that functionality shouldn't be duplicated all over the place.  Creating yet another tool to do the task doesn't make sense when you can touch and chmod already.  That other tool you propose would be a duplication of chmod.  And that is the problem here too.  Should every tool that creates files have a --mode override?

I'm not sure which other tools you are reffering. mkdir, mknod already have --mode option and in my subject I have clearly specify about touch utility.

And for that matter I have yet to see a rationale for using --mode here in a real example that can't be satisified simply by using an appropriate umask.

> > Why would one prefer the GNU-specific touch --mode ... > > over the portable combination of touch and chmod? > > Cause its easier to do 'touch --mode xxx filename' than 'touch > filename' and 'chmod xxx'.

I disagree.  Doing the touch followed by chmod is the more obvious way.  And for many decades the standard way.  And therefore easier to maintain.

If you disagree, I really don't have to say anything. And I also disagree with your obvious way. Utility should something that reflects user needs, offcourse maintaining all the standards. Programmers does the tough job to make user's life easier, not how a programmer can make a life harder for user.

> And Eric also pointed out that we will be able to do 'touch -r a -M > b' to create a referenced file with different mode.

I am not strongly opposed to having this added to the code.  But to me this looks like a solution looking for a problem to solve.  It is the type of thing that if I ever saw actually used in a script that I would immediately edit into their standard touch and chmod versions without giving it a second thought.

I was pointing to the advantage of adding this feature. Maybe we'll find more when it will be in action. :)

thanks, rakib

Bob