Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I've seen a few different questions about ls hanging. It's usually because they use the -l switch, which causes a stat on the file, which in turn is a bad symlink or pointing to an NFS mount or some such.

I have a local file (in an old copy of the Git source that somebody else unpacked, of all things) that causes stat to hang, but responds to CTRL-C. It also causes ls -l to hang, hard, such that it does not respond to kill (but does terminate on a kill -9).

It's not a symlink. The other files in the directory appear to stat without issue. I've recently rebooted the machine with forced fsck, which came out clean, and dmesg shows no disk-related messages. How can this be?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

It may be a problem in getting the user name or group name, if you use and LDAP or NIS or other sources for that. What are you passwd and group lines in /etc/nsswitch.conf? This may be the case if an ls -nl return immediately.

share|improve this answer
    
Unless it is looking for extra sources for that data when something isn't found, it would hang all the time (i.e., get the name, return it; don't get it, return anyway). Isn't too plausible. Perhaps the file is somehow messed up (and a fsck(8) might be in order)? –  vonbrand Jan 30 '13 at 13:04
    
Right, but he might have long timeouts. So this is still a possibility. –  eppesuig Jan 30 '13 at 13:16
    
I said not plausible, not that it was out of question. –  vonbrand Jan 30 '13 at 13:35
    
Some other ridiculous ideas: A symlink to somewhere strange? stat (no switches) say anything? –  vonbrand Jan 30 '13 at 13:37
    
The crazy part is that stat hangs after printing that this is a normal file, nothing to see here, move along. Closes with a ctrl-C though. –  Coderer Jan 30 '13 at 16:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.