why does this happen?

J

Jürgen Exner

Uno said:
What I typically do when I begin to code for a utility like the one I
desire is that I start with some more or less standard template, make it
compile and perform--for perl these steps are less discrete, and see if
I agree with my output.

Well, ok, I think I got this.
So far on ubuntu, I have only used gedit for writing source. When I've
got the template working, I iterate the number that postpends in the
filename.

So, let me rephrase that: Are you saying, you are _SAVING_ the file
under a new name from your editor?
That would be very, very different from renaming an existing file, i.e.
from what you claimed you were doing before.
So when I rename perl2.pl to perl3.pl, this is what I get:

jue
 
U

Uno

Jürgen Exner said:
Well, ok, I think I got this.


So, let me rephrase that: Are you saying, you are _SAVING_ the file
under a new name from your editor?
That would be very, very different from renaming an existing file, i.e.
from what you claimed you were doing before.


jue

Yeah. I was really tripped by the permissions not being the same from
saving with gedit.

It's been a very good tool for me so far. I've upgraded on my windows
partition from notepad to potepad++, and I can't believe I didn't
upgrade earlier.

Ben Bacarisse from clc once recommended something called emacs.

What is that?
 
U

Uno

Mike Lovell wrote:

[you can lower your security clearance to talk to me]

I really would like to get this capability rolling. As soon as I do,
I'll have a perl program to post.

Until then, I've got this:

$ pwd
/home/dan/source/amd64
$ ls *
codeblocks_10.05-1_amd64.changes codeblocks-doc-en_10.05-1_all.deb
codeblocks_10.05-1_amd64.deb
codeblocks-headers_10.05-1_all.deb
codeblocks-common_10.05-1_all.deb libcodeblocks0_10.05-1_amd64.deb
codeblocks-contrib_10.05-1_amd64.deb libwxsmithlib0_10.05-1_amd64.deb
codeblocks-contrib-common_10.05-1_all.deb
libwxsmithlib0-dev_10.05-1_amd64.deb
codeblocks-dev_10.05-1_amd64.deb wxsmith-dev_10.05-1_amd64.deb
codeblocks-doc-de_10.05-1_all.deb wxsmith-headers_10.05-1_all.deb
$

I've got ideas here but no experience.
 
U

Uno

Uri said:
U> Well I hope I haven't stepped on a landmine. Thanks all for
U> replies. There seems to be some smoke from other fires, so I wanted to
U> begin with getting a handle on the bone-headed stuff:

U> What I typically do when I begin to code for a utility like the one I
U> desire is that I start with some more or less standard template, make
U> it compile and perform--for perl these steps are less discrete, and
U> see if I agree with my output.

U> So far on ubuntu, I have only used gedit for writing source. When
U> I've got the template working, I iterate the number that postpends in
U> the filename. I couldn't say that any more clearly with a microphone.

nope. you have been as clear as mud so far.

HOW did you do the rename itself? you have yet to show that. the unix
mv command will not touch permissions.

U> So when I rename perl2.pl to perl3.pl, this is what I get:

U> $ ls -l perl*
U> -rwx------ 1 dan dan 405 2010-04-01 12:37 perl1.pl
U> -rw------- 1 dan dan 269 2010-04-01 12:30 perl1.pl~
U> -rwxr-xr-x 1 dan dan 580 2010-09-25 21:47 perl2.pl
U> -rw-r--r-- 1 dan dan 527 2010-09-25 19:20 perl2.pl~
U> -rw-r--r-- 1 dan dan 580 2010-09-30 21:40 perl3.pl
U>

i smell a rat. did you do a save as type of thing in you editor? that
creates a new file with new permissions and likely won't enable the x
bits. and what is so hard about doing a chmod +x on your program?

U> Is there maybe a better way to develop perl, fortran and C on Ubuntu
U> than gedit?

teco if you can get it? :)

uri


the rat was that I used mv and confounded the "usual" order of things.

what is teco?
 
U

Uno

Jens said:
This is not at all related to Perl (as the leading "bash:"
in the error messages indicates, it's something from the
shell (bash) you're using). You don't have execute permis-
sions for the new file 'perl2.pl', resulting from whatever
you did but do not tell (there's no "increment" from "perl1"
to "perl2"). Do

chmod 755 perl2.pl

or

chmod +x perl2.pl

and things will start to work again.

Jens

Das hat mich enttaeuscht.

Jens
 
M

Mike Rechtman

Yeah. I was really tripped by the permissions not being the same from
saving with gedit.

It's been a very good tool for me so far. I've upgraded on my windows
partition from notepad to potepad++, and I can't believe I didn't
upgrade earlier.

Ben Bacarisse from clc once recommended something called emacs.

What is that?
emacs is more than just an editor -- it is a way of life...
long learning curve, not meant for occasional use.
(Personally -- I use TPU on VMS)

--
Mike R.
Home: http://alpha.mike-r.com/
QOTD: http://alpha.mike-r.com/php/qotd.php
No Micro$oft products were used in the URLs above, or in preparing this message.
Recommended reading: http://www.catb.org/~esr/faqs/smart-questions.html#before
 
U

Uno

Tad said:
["Followup-To:" header set to comp.lang.perl.misc.]



Then you should not have posted it to a Perl newsgroup!



There is no part that is germane to Perl (nor to perl).

What do you mean by "iterate the integer that postpends the source
file"? And what's a f90 file?


I expect that he did something like:

rename 1 2 rm1.f90

Though he never said what he did, which is pretty silly, as what
he did is germane to what ended up happening...

I haven't gotten to the perl part yet due to technical difficulties. It
is the other subthread that is yet to happen.

Uno
--

I'm sorry for your preventable loss.

Rest In Peace:
Jonah McClellan gave his life for his country in a
helicopter crash in Afghanistan on September 21,2010.
Please pray for his wife and three children.

Lutherans do every week they show up.
 
J

Jonathan N. Little

Uno said:
Well I hope I haven't stepped on a landmine. Thanks all for replies.
There seems to be some smoke from other fires, so I wanted to begin with
getting a handle on the bone-headed stuff:

What I typically do when I begin to code for a utility like the one I
desire is that I start with some more or less standard template, make it
compile and perform--for perl these steps are less discrete, and see if
I agree with my output.

So far on ubuntu, I have only used gedit for writing source. When I've
got the template working, I iterate the number that postpends in the
filename. I couldn't say that any more clearly with a microphone.

So when I rename perl2.pl to perl3.pl, this is what I get:

$ ls -l perl*
-rwx------ 1 dan dan 405 2010-04-01 12:37 perl1.pl
-rw------- 1 dan dan 269 2010-04-01 12:30 perl1.pl~
-rwxr-xr-x 1 dan dan 580 2010-09-25 21:47 perl2.pl
-rw-r--r-- 1 dan dan 527 2010-09-25 19:20 perl2.pl~
-rw-r--r-- 1 dan dan 580 2010-09-30 21:40 perl3.pl
$

Okay as others have asked *how are you "renaming" your script?*

If you use cp or mv the permissions remain. Example I created a small
shell script and made it executable:

$ ls -lha
total 12K
drwxr-xr-x 2 jonathan jonathan 4.0K 2010-10-01 10:08 .
drwxr-xr-x 68 jonathan jonathan 4.0K 2010-10-01 10:08 ..
-rwxr-xr-x 1 jonathan jonathan 25 2010-10-01 10:08 ascript

Now I copy "ascript" to "ascriptbycp" using cp, same result if you mv to
rename:

$ cp ascript ascriptbycp

$ ls -lha
total 16K
drwxr-xr-x 2 jonathan jonathan 4.0K 2010-10-01 10:09 .
drwxr-xr-x 68 jonathan jonathan 4.0K 2010-10-01 10:08 ..
-rwxr-xr-x 1 jonathan jonathan 25 2010-10-01 10:08 ascript
-rwxr-xr-x 1 jonathan jonathan 25 2010-10-01 10:09 ascriptbycp

Permissions remain, but that is *not* how you renamed the script did
you. You used a text editor and to give it a new new name use used the
editor's "Save As" function. Well of course you will loose the
executable attribute! A perl script like a shell script is just a text
file. When you use an editor's "Save As" function you are not renaming
the script, but making a *new* text file. Text files by default are not
supposed to be executable. Confirmed in my example where I open
"ascript" in a text editor and saved as "ascriptbysaveas" see it is just
a plain text file:

$ ls -lha
total 20K
drwxr-xr-x 2 jonathan jonathan 4.0K 2010-10-01 10:10 .
drwxr-xr-x 68 jonathan jonathan 4.0K 2010-10-01 10:10 ..
-rwxr-xr-x 1 jonathan jonathan 25 2010-10-01 10:08 ascript
-rwxr-xr-x 1 jonathan jonathan 25 2010-10-01 10:09 ascriptbycp
-rw-r--r-- 1 jonathan jonathan 25 2010-10-01 10:10 ascriptbysaveas

No mystery here.
 
M

Mart van de Wege

Uno said:
Well I hope I haven't stepped on a landmine.

Well, you not particularly. It would have been helpful if you had
answered the first query on *how* you 'iterated' your filenames
(apparently by saving under a new name from your editor), but aside from
that I won't fault you.

If people start throwing out advice which a) is not correct, and b) not
germane to your question, and c) posted by a known troll, then *those*
people get flamed.

Mart
 
J

Jürgen Exner

Uno said:
Yeah. I was really tripped by the permissions not being the same from
saving with gedit.

It is a new file! New! Not a renamed file.
Why would it inherit it's permissions from some other arbitrary file
only because they happen to have similar names?
Ben Bacarisse from clc once recommended something called emacs.
What is that?

comp.[...].editors.emacs is over that way there.

jue
 
U

Uno

Jürgen Exner said:
It is a new file! New! Not a renamed file.
Why would it inherit it's permissions from some other arbitrary file
only because they happen to have similar names?

What it means to me is that I want a new development environment. Btw,
"it's" is a contracting for "it is." The third person neuter possessive
in english is "its."

It's the exception to the rule.
Ben Bacarisse from clc once recommended something called emacs.
What is that?

comp.[...].editors.emacs is over that way there.

I'm looking through the tutorial now and know that I don't want to
memorize a bunch of control characters again.
 
M

Mart van de Wege

Tad McClellan said:
["Followup-To:" header set to comp.lang.perl.misc.]



vi has the same behavior as gedit, ie. no execute permission
on new files.

What it means to me is that I want a new development environment.


No, you simply need a new development _process_.

If you know before the edit session that you'll want a new name,
then cp (copy) it, which preserves the permissions:

cp rm1.f90 rm2.f90
gedit rm2.f90

then use "Save" rather than "Save As" after you've made your edits.
Or he learns how to use a version control system.

After all, what he is doing now is manual version control. That's error
prone and tedious, precisely the thing to automate.

I prefer git, it's lightweight and fairly easy to learn:

1. 'git init' in your project directory.

2. 'git add <files>' to add the files you want to track (I often do a
'git add *' on my initial files)

3. 'git commit' and type your commit message.

Then, just after every major change, just 'git commit' again.

I am of the vi religion.

Can some heretic of the emacs religion tell us if emacs behaves
the same as vi and gedit?

That is, when you write a file with a new name in emacs, does
it preserve file permissions?

Emacs heretic here. No it doesn't.

Mart
 
P

Peter J. Holzer

It is a new file! New! Not a renamed file.
ACK.

Why would it inherit it's permissions from some other arbitrary file
only because they happen to have similar names?

Actually, if you use an editor to open file "A", possibly edit it, and
then save it as "B", I don't think it is entirely unreasonable to assume
that B will have the same permissions as A. A is not "some other
arbitrary file with a similar name", it is an older version of B, and
the editor knows it, so it could set the permissions of B to match those
of A. I don't know any editor which does this, and I've never missed the
capability, but now that I think about it, this seems like a good thing
to me.

hp
 
J

J G Miller

Actually, if you use an editor to open file "A", possibly edit it, and
then save it as "B", I don't think it is entirely unreasonable to assume
that B will have the same permissions as A.

A big assumption there.

What if A is owned by somebody else?

The editor should respect umask -- and that should
be the end of the matter.
 
P

Peter J. Holzer

A big assumption there.

What if A is owned by somebody else?

Well, what does cp do in this case?

I don't see why "open file A in editor, save as B" should work
differently than "cp A B".

hp
 
J

J G Miller

Well, what does cp do in this case?

With or without the -p flag? ;)
I don't see why "open file A in editor, save as B" should work
differently than "cp A B".

Do you really think that if the system allowed you to keep the
suid or guids permissions on files not belonging to you, that
would be good for security?
 
E

Eric Pozharski

with said:
I would go a step further - it wouldn't be unreasonable for an editor
to set the executable bit on any file that begins with a shebang, if
of course the current umask allows it.

I beg to differ the whole trend here. An editor either can or can't
read a file (the latter case, file is unreadable). An editor either can
or can't create pre-rename(2) file (the latter case, file is
unwritable). Point. Anything else permission-related activity is,
let's say it, vulnerability. The vim's 'autocmd's (and AFAICO, emacs
has something same) are holes wide enough already.

If anyone wants more holes then the poor thing should switch to that
toy-OS.
 
H

Huge

I would go a step further - it wouldn't be unreasonable for an editor
to set the executable bit on any file that begins with a shebang, if of
course the current umask allows it.

Yes it would. It goes against the Unix ethis of one tool doing one thing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top