File: Broken_lstat

package info (click to toggle)
yard 1.17.patch1-5
  • links: PTS
  • area: main
  • in suites: potato
  • size: 600 kB
  • ctags: 74
  • sloc: perl: 1,729; sh: 250; makefile: 176; asm: 32
file content (58 lines) | stat: -rw-r--r-- 2,508 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
If you're reading this, it's probably because Yard's configure script
complained that your Perl's lstat or -l file operator are broken.

lstat is a system call that provides information on symbolic links
("symlinks") in a filesystem.  All versions of Linux have lstat.  Some
Perl binaries were distributed in which the interface to lstat is
broken.  I strongly suggest you upgrade your Perl if Yard's test says
it's broken.  This bug will cause problems for Yard, and probably
other Perl scripts as well.

If you're using an old Perl this may be an old bug, in which case you
should simply upgrade.  If you're running a version of Perl that came
with a recent distribution of Linux, please contact me
(fawcett@nynexst.com) and I'll check into it and forward the complaint
to the distribution maintainer.

After you upgrade Perl you should be able to configure and run Yard
successfully.


A More Technical Explanation

stat and lstat are system calls that return information about files.
("man 2 stat" will give complete details).  On a plain file they both
return the same thing; on a symbolic link (eg, "A -> B") stat follows
the link and returns info on B, whereas lstat returns data on the link
A itself.  lstat is necessary in order to detect symlinks at all;
Perl's lstat() function and its "-l" file test both depend on the
lstat system call.

Perl runs on many operating systems, some of which don't support
symbolic links (so don't have lstat).  When Perl is built, its
automatic configuration script checks to see whether the OS can do
lstat, and if not it arranges to do a stat instead.  On an OS such as
Linux, which DOES support symlinks and lstat, this substitution can
cause problems because Perl will be unable to detect symbolic links
and will return information on the file instead of the link.  In
particular, Yard checks symlinks and may become confused by this.
Several people have reported apparent bugs in the way Yard deals with
libraries, which errors were caused by misconfigured Perl binaries.

To demonstrate this brokenness, run the following commands from the shell:

touch ABC
ln -s ABC DEF
perl -e 'if (-l "DEF") {print "YES\n"} else {print "NO\n"}'

The first two lines create a file ABC and a symlink DEF.  The third
line tests Perl's -l operator; if it prints NO, Perl can't recognize
symlinks.  Then run this:

perl -e 'use Config; print "d_lstat= $Config{d_lstat}\n"'

If Perl was configured with lstat this should print:
	d_lstat= define  
and if not, 
	d_lstat= undef