Operating System - HP-UX
1752672 Members
5881 Online
108789 Solutions
New Discussion юеВ

Getting "./.." not found error though parent dir is present!

 
Srini Jay
Valued Contributor

Getting "./.." not found error though parent dir is present!

Hi,
I'm having a strange problem on one of our HP UX Itanium server running 11.23.

When I do a 'ls -al' on a particular directory, I'm getting the below listed error message though the parent dir exists! Any idea what could be the problem?

# ls -al tmpdir
tmpdir/.. not found <-- what is this???
total 16
drwxrwxr-x 2 xxxxxx dev 1024 Nov 10 15:33 ./
-rwxr-x--- 1 xxxxxx dev 23 Nov 10 15:31 sj1.con*
-rw-rw-r-- 1 xxxxxx dev 19 Nov 10 15:33 sj1.hold

# echo $?
0

# cd tmpdir
# ls -al
./.. not found <--- what is this???
total 16
drwxrwxr-x 2 xxxxxx dev 1024 Nov 10 15:33 ./
-rwxr-x--- 1 xxxxxx dev 23 Nov 10 15:31 sj1.con*
-rw-rw-r-- 1 xxxxxx dev 19 Nov 10 15:33 sj1.hold

# echo $?
0

Thanks,
SJ
11 REPLIES 11
Srini Jay
Valued Contributor

Re: Getting "./.." not found error though parent dir is present!

Additional information:

Though 'ls' is returning the error, "cd .." works fine!
TTr
Honored Contributor

Re: Getting "./.." not found error though parent dir is present!

type the output of "ls | od -c"

Also the filename sj1.con* is an invalid filename, it has an asterisk in it. You should remove or rename that file.
James R. Ferguson
Acclaimed Contributor

Re: Getting "./.." not found error though parent dir is present!

Hi:

> TTr: Also the filename sj1.con* is an invalid filename, it has an asterisk in it.

It's would appear that the OP has aliased 'ls' with the '-F' switch which adds a slash character to the end of any filename that is a directory and adds a "*" to the end of any executable file.

The OP could use:

# /usr/bin/ls -al

...and/or show the output of:

# alias

One possibility for the reported behavior is that the OP changed into the directory and then deleted it before doing the 'ls'.

Regards!

...JRF...
James R. Ferguson
Acclaimed Contributor

Re: Getting "./.." not found error though parent dir is present!

Hi (again):

See also this thread:

http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=133279

Regards!

...JRF...
Srini Jay
Valued Contributor

Re: Getting "./.." not found error though parent dir is present!

Here is the output from 'ls | od -c':

0000000 s j 1 . c o n \n s j 1 . h o l d
0000020 \n
0000021

Pls ignore the '*'; I'd alias set for 'll' and it was actually doing a 'ls -alF' and so all executable files show up a '*' at the end.
Srini Jay
Valued Contributor

Re: Getting "./.." not found error though parent dir is present!

@ JRF:
You are right, I'd alias set the way you had mentioned.

The dir of concern (tmpdir) or its parent dir are not mount points.

Both tmpdir and its parent exist on the system, with the parent dir permission being 777! There is no special ACL set for any of these dirs. And best of all, I can traverse to this tmpdir and back to its parent dir without any problem. 'du' runs fine against both these dirs.

Only problem is that 'ls -al' throwing this error and a thirdparty tool fails. I'm guessing there is some problem with the directory entry. Is there any tool to check a dir's consistency (not the whole filesystem).

Thanks!
Dennis Handly
Acclaimed Contributor

Re: Getting "./.." not found error though parent dir is present!

>Is there any tool to check a dir's consistency (not the whole filesystem).

There is only fsck(1m) for the whole filesystem.

One check you can make while in tmpdir:
pwd -P # sh/ksh
/usr/bin/pwd

These will fail if ".." isn't there.
Peter Nikitka
Honored Contributor

Re: Getting "./.." not found error though parent dir is present!

Hi,

I think, the fastest solution would be to move the content of this corrupted directory to another - if no readonly filesystem is in play.

mkdir tdirnew
mv tmpdir/sj1* tdirnew
mv tmpdir tdirold
mv tdirnew tmpdir
rmdir tdirold

Check for error messages after the execution of each command. Perhaps you want to keep the corrupted directory for testing purposes.

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Srini Jay
Valued Contributor

Re: Getting "./.." not found error though parent dir is present!

Thanks everyone, but without knowing how to avoid this error, my problem will be resolved!

The problem is that similar 'tmpdir's are created by our job scheduler and occasionally the jobs fail with the above said error.

I wrote a C program to read the dir entry and it read both '.' and '..'; its only the 'ls' command that is not finding the parent dir entry '..'.

I think I'll check the whole filesystem on a later day when I can take the filesystem offline.