why does this happen?

U

Uno

Hello newsgroups,


How do I not have permission here, when all I did is increment from
perl1 to perl2. Does a file get stripped of its priveleges automatically.

$ ./perl1.pl
Placido P. Octopus
Polypacido P. Octopus

Placido P. Octopus
Polypacido Polyp Octopus

Placido P. Octopus
Placido Polyp Octopus

$ ./perl2.pl
bash: ./perl2.pl: Permission denied
$

This is the source:

$ cat perl2.pl
#!/usr/bin/perl

use strict;
use warnings;

my $string = "Placido P. Octopus\n";
my $regex = "P.";

my $string1 = $string;
print $string1;
$string1 =~ s/$regex/Polyp/;
print $string1;
print "\n";

my $string2 = $string;
print $string2;
$string2 =~ s/$regex/Polyp/g;
print $string2;
print "\n";

my $string3 = $string;
print $string3;
$string3 =~ s/\Q$regex/Polyp/;
print $string3;
print "\n";

# that's the last perl I used
# I build off what I have.

my $filename = "text1.txt"
print $filename

$


Thanks for you comment,
and cheers,
 
J

Jens Thoms Toerring

In comp.lang.perl.misc Uno said:
How do I not have permission here, when all I did is increment from
perl1 to perl2. Does a file get stripped of its priveleges automatically.
$ ./perl1.pl
Placido P. Octopus
Polypacido P. Octopus
$ ./perl2.pl
bash: ./perl2.pl: Permission denied
$

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
 
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

Na, Jens, why the heck does my OS change permissions when I rename a file?

$ ./perl2.pl
Placido P. Octopus
Polypacido P. Octopus

Placido P. Octopus
Polypacido Polyp Octopus

Placido P. Octopus
Placido Polyp Octopus

text1.txt
$ cat perl2.pl
#!/usr/bin/perl

use strict;
use warnings;

my $string = "Placido P. Octopus\n";
my $regex = "P.";

my $string1 = $string;
print $string1;
$string1 =~ s/$regex/Polyp/;
print $string1;
print "\n";

my $string2 = $string;
print $string2;
$string2 =~ s/$regex/Polyp/g;
print $string2;
print "\n";

my $string3 = $string;
print $string3;
$string3 =~ s/\Q$regex/Polyp/;
print $string3;
print "\n";

# that's the last perl I used
# I build off what I have.

my $filename = "text1.txt";
print "$filename\n";

#end program

$

Tscheuss und gruss,
Jens, aka,
 
R

Ron Bergin

Na, Jens, why the heck does my OS change permissions when I rename a file?

Your OS won't do that, but since you didn't show us how you renamed
the file, we can't say what you did wrong.
 
J

Jürgen Exner

Uno said:
Na, Jens, why the heck does my OS change permissions when I rename a file?

You may want to ask in NG that deals with whatever OS you are using (you
didn't even say!).

Aside of that Jens was right: that error message is not a Perl error
message, it is clearly issued by your shell.

jue
 
U

Uno

Jürgen Exner said:
You may want to ask in NG that deals with whatever OS you are using (you
didn't even say!).

I x-posted to ubuntu.
Aside of that Jens was right: that error message is not a Perl error
message, it is clearly issued by your shell.

Nuts, jue, I have every belief that it wasn't perl. Maybe you can help
me with this while the other subthread considers the part that is
germane to perl.

So I rename rm1.f90 to rm2.f90, and I have no problem on the command
line except to iterate the integer that postpends the source file.

Why is perl different?

Gruss,
 
J

jellybean stonerfish

Hello newsgroups,


How do I not have permission here, when all I did is increment from
perl1 to perl2. Does a file get stripped of its priveleges
automatically.

$ ./perl1.pl
Placido P. Octopus
$ ./perl2.pl
bash: ./perl2.pl: Permission denied
$

I don't know how you made perl2.pl
Try "ls -l perl1.pl perl2.pl"
Do they both have the same permissions?
 
P

Peter J. Holzer

I x-posted to ubuntu.

Nuts, jue, I have every belief that it wasn't perl. Maybe you can help
me with this while the other subthread considers the part that is
germane to perl.

So I rename rm1.f90 to rm2.f90, and I have no problem on the command
line except to iterate the integer that postpends the source file.

How did you rename the file? The mv command doesn't change the
permissions.

Why is perl different?

One difference is that a fortran source file is not directly
executable. You cannot start it with "./rm1.f90". You have to use a
fortran compiler to produce an execuable, and the compiler (or rather
the linker) will set the correct permissions on the executable. A Perl
script on the other hand can be executed, but since you create it
(usually) with a text editor, you have to set the permissions yourself
(since the editor doesn't know or care whether you're writing a perl
script or a letter to your mother in law).

hp
 
E

Eric Pozharski

with said:
Jens Thoms Toerring wrote: *SKIP*
Na, Jens, why the heck does my OS change permissions when I rename a file?

Because you're using wrong tools. Your file manager sucks, use shell
instead (whatever, I prefer zsh).

*CUT*
 
M

Mart van de Wege

Hadron said:
As a side note regarding perl if he's a complete beginner which seems
likely it might be worth suggesting he doesnt put his scripts on the
path and he doesn't set them for exec

As usual, you are talking bollocks.

He's using syntax that indicates he is *NOT* executing his scripts from
his $PATH. And as long as you do not explicitly do what every Linux
distribution has prevented you from doing, setting a script in your
current directory to executable is no problem at all.

Mart
 
J

Jürgen Exner

Uno said:
I x-posted to ubuntu.

Nuts, jue, I have every belief that it wasn't perl. Maybe you can help
me with this while the other subthread considers the part that is
germane to perl.

???
No idea what you are trying to say in that paragraph.
So I rename rm1.f90 to rm2.f90, and I have no problem on the command
line except to iterate the integer that postpends the source file.

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

perl doesn't even come into the game yet. This error message "bash:
../perl2.pl: Permission denied" is thrown by bash _BEFORE_ bash even
attempts to call the perl interpreter.
It's a feature of your shell: you cannot execute a program unless you
have execute permissions for that program. And this is the same for any
executable file, no matter what programming language it is written in.

jue
 
J

Jürgen Exner

Hadron said:
The same for any *file*.

Except its not. He can "execute" the file by passing it to perl. And
this would be the recommended way for a noob playing with such.

"perl ./myfile"

"sh ./mybashscript"

etc.

So, if I understand you correctly then you are confirming, too, that
Perl is no different than any other programming language, right?

jue
 
M

Mart van de Wege

Hadron said:
I suggested that its not on the path IN CASE : hence I mentioned
SPECIFICALLY running perl. At no point did I say they are currently on
the path either.
Actually, you did. Otherwise your suggestion that he shouldn't put his
scripts in his $PATH wouldn't make any sense.

Then again, you seldom make any sense anyway.
My POINT was that you DONT NEED exec permissions when developing when
you specifically invoke perl.
Then you shouldn't have said so. Instead you strongly suggested that
it's not a matter of *need*, but a matter of *don't*. Which, as I
explained, is unnecessary in this case, as the OP is obviously aware how
to execute a file in his cwd.
That is VERY common during development : I dont expect you to understand.
I suspect I write more perl during a working day than you have done in
your entire life.
You're a moron.

Coming from you, that's a compliment.

Sorry to the clpm guys, but Hadron is a known troll in aolu and advocacy
groups (not that advocacy needs more trolls, but he alone can make up
half the traffic in one).

I've set follow-ups to aolu.

Mart
 
P

Peter J. Holzer

"So I rename rm1.f90 to rm2.f90,"

Doesn't mean anything to you either?

That would normally mean that he invoked

mv rm1.f90 rm2.f90

But that doesn't have to claimed effect of changing the permissions, so
I doubt he did that.

"rename" is not a standard POSIX command. My system has a rename
command, but it apparently has a different syntax than Tad's rename
command:

rename [ -v ] [ -n ] [ -f ] perlexpr [ files ]

And the OP might also have used a graphical shell or some other tool.

No use guessing. Several people have now asked the OP how he "renamed"
the file, and we should just wait for his answer.

hp
 
P

Peter J. Holzer

perl doesn't even come into the game yet. This error message "bash:
./perl2.pl: Permission denied" is thrown by bash _BEFORE_ bash even
attempts to call the perl interpreter.
It's a feature of your shell: you cannot execute a program unless you
have execute permissions for that program. And this is the same for any
executable file, no matter what programming language it is written in.

Nope. It's a feature of the OS kernel, not the shell. At least on unixes
younger than about 20 years or so.

hp
 
J

Jürgen Exner

Hadron said:
So
"So I rename rm1.f90 to rm2.f90,"
Doesn't mean anything to you either?

No, in this context it means the OP isn't telling the real story.

The obvious interpretion of "rename" using "mv old.pl new.pl" cannot be
right because mv doesn't change any permissions.
Therefore there must be something else going on which the OP is not
telling. So, no, "rename" doesn't mean anything in this context.

jue
 
M

Mart van de Wege

Hadron said:
Oh ffs : his entire issue was permissions. My point, which I extended
on, was that he doesnt NEED permissions AND mentioned the path too.
No, you didn't phrase it like that, so stop whining if people don't read
it like that.
You're not a programmer,

I am not. I am a systems administrator that does some programming on the
side.

You, however, are a troll. Which you just proved by restarting the
cross-post after I removed the off-topic groups.

Follow-ups restored to aolu.

Mart
 
M

Mart van de Wege

Hadron said:
I figured. You're total inability to process and understand my well
meant reply to the OP told me all I needed to know. You're a case of a

So, where's your contribution then? I at least have my name to a minor
patch in a CPAN module. You have *never* produced anything.

You can mail the proof if you want to. I'm done with you here.

Follow-up to -9999.

Mart
 
U

Uno

Mart said:
Follow-up to -9999.

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
$

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

Uri Guttman

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
 

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

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top