RE: Hidden Characters?
by lemming (Priest) on Nov 14, 2000 at 01:42 UTC
|
Warning! Probably not the solution.
I've had this problem before and I don't think it's a DOS/UNIX test
problem. (Some years ago at a different company.)
However, see if the program operate differently if you type
$ perl program.pl
$ program.pl
With 5.6 on redhat 6.2 a Dos newline will run example #1,
but not #2. (bash command not found)
Back to the problem
It might be a system problem. Check your inode space. Do a df -i.
I don't think that's the case, but some other system resource is hanging you up.
The previous posts give good clues as well.
Is this a program that performs writes? I know I ran into this problem before and it was most likely with a program that opened multiple files and wrote out log files. This problem is really bugging me that I don't remember the solution.
Hopefully this will give you an area in which to look.
UPDATE: Another idea. Are you using Samba or maybe NFS? For some reason that's tickling the back of my brain.
| [reply] [Watch: Dir/Any] |
Re: Hidden Characters?
by AgentM (Curate) on Nov 14, 2000 at 00:59 UTC
|
Are you referring to the FTP "problem" where Win or Mac to Linux files throw in an extra char for newlines? In that case, ALL newlines are affected, not just the first line. I'm not sure whether Perl likes funky chars like ^M in it's parsing engine, so a sort of converter would be in order. All it needs to do is convert the DOS newline to the '\n' (that's the C character \n and not the Perl \n for your info, but under Linux the C code is \n anyway...) I'm sure there is already one readily available somewhere on this site....hmmm...
The second problem (seemingly unrelated) deals with a text file busy response. That's not a perl error response (at least not in <5.6 since I just looked it up in an old book) and probably has something to do with a mandatory lock failure on open(). I can't imagine that perl tries to lock the file (does it, though?), so you are probably using a linux kernel with mandatory locking compiled in...is that right? Anyway, I don't think emacs is locking the file (it does not, by default, unless...well, not by default). What made you cp it somewhere else and back. If this were mandatory locking, cp would fail on the open read just as perl would. No- something is fishy in your story. (p.s. emacs will not IN ANY FASHION insert a hidden character as you propose unless you save it in some strange manner (DOS mode?) and these two problems that you are having are unrelated!)
AgentM Systems nor Nasca Enterprises nor
Bone::Easy nor Macperl is responsible for the
comments made by
AgentM. Remember, you can build any logical system with NOR.
| [reply] [Watch: Dir/Any] |
Re: Hidden Characters?
by tame1 (Pilgrim) on Nov 14, 2000 at 01:55 UTC
|
In re: to everyone who responded:
ems::jrobiso2-->perl myprog.pl works fine
ems::jrobiso2-->./myprog.pl gives the "error opening text file" message
I've closed emacs and tried running it - no avail.
Only cp the file seems to clear up the message
What does this little button do . .<Click>;
"USER HAS SIGNED OFF FOR THE DAY" | [reply] [Watch: Dir/Any] [d/l] [select] |
|
Two questions:
- Does the output of 'which perl' (on the command-line) differ from the first line of your Perl script (in other words, are you calling two different versions of the same Perl executable)? Perhaps it's the Perl binary itself that's giving you this error message.
- Try viewing your script with 'vi' or 'view', which typically gives you a better view of any embedded control characters (such as an evil trailing DOS newline). A standard pager (like less or more) typically ignores trailing ^M's. Emacs may also.
- Do you have 'lsof' on your system? Is there any way you can identify any other applications that might have this script open? Perhaps Emacs is somehow continuing to hold a lock?
The open syscall can fail with this message (ETXTBSY), but usually only if the requested file is being executed (which may not be the case or make sense in this instance, since Perl scripts aren't so much executed as they are read by the Perl interpreter) when an open request comes in with O_WRONLY or O_RDWR flags. This doesn't really make a lot of sense.
What operating system are you using? I'd like to dig further on the cases where you'd get this message. I'd also kinda like to see the first line of your script, the location of your Perl binary, and the permissions of your script.
| [reply] [Watch: Dir/Any] |
|
Let's see....ok. The "regular" perl binary is /usr/bin/perl (which is
itself a link to /usr/bin/perl-5.00503
My shebang is #!/usr/local/bin/perl -w which is a symlink to /usr/bin/perl
So yes, there are two levels of syms involved.
However, I think one of the earlier guys had it - my emacs is
saving in DOS mode. Why, I have no idea. How to stop it, I also
don't know. Does anyone?
What does this little button do . .<Click>;
"USER HAS SIGNED OFF FOR THE DAY"
| [reply] [Watch: Dir/Any] |
|
RE: Hidden Characters?
by mitd (Curate) on Nov 14, 2000 at 10:47 UTC
|
Horse dickies!
If one would would like to confirm or deny hidden chars
from within emacs just:
M-x hexl-mode[RET]
or
M-x hexlify-buffer[RET]
A 'dickey or dicky' was a fake turtle neck usually
worn under a V neck sweater and made popular by Herman's Hermits
in the 60's. Not that other thing you thought it... oh lets
just not go there
Whenever I use vi my pinky gets tired. Why is that?
mitd-Made in the Dark
'My favourite colour appears to be grey.' | [reply] [Watch: Dir/Any] [d/l] |
|
Yeah - I know. That's why this is so wierd. There appear to be NO
hidden characters!!!
What does this little button do . .<Click>;
"USER HAS SIGNED OFF FOR THE DAY"
| [reply] [Watch: Dir/Any] |
|
How do hidden characters show up in hexl-mode?
| [reply] [Watch: Dir/Any] |
Re: Hidden Characters?
by Fastolfe (Vicar) on Nov 14, 2000 at 00:42 UTC
|
Is emacs still open, or do you exit it before you try to run your script? It sounds almost like a program is putting a lock on the file, preventing it from being read by another application. It's not inserting any characters.
Update: Typically you get this error when you attempt to execute or write to a file that is currently being written to. So it may have less to do with locking and more to do with slow writes? Note that you can get this error against the Perl binary itself, not just a script. Don't be misled by the word "text".
The solution is just to wait until Emacs is finished saving the file. If you're sure this is the case, and you continue to consistently get this error message even after exiting Emacs, maybe do an 'lsof' on the file and see if you can identify any other applications that have it open.
Update: Note that Re: Hidden Characters? makes these theories unlikely. Very weird problem. | [reply] [Watch: Dir/Any] |
Re: Hidden Characters?
by b (Beadle) on Nov 14, 2000 at 00:44 UTC
|
| [reply] [Watch: Dir/Any] |