in reply to Re: Problem using Net::Netrc and Tie::File
in thread Problem using Net::Netrc and Tie::File

Since the latest Net::Netrc is from 3/2004, and the Netrc and FTP man pages certainly don't mention that the use of ~/.netrc is deprecated. I don't believe it's use is deprecated.
The file permissions for ~/.netrc are 0400 as specified in the documentation.
Since the script hangs at the point it is accessing the netrc file I can do no further error checking. Also, since the script previously ran fine without the use of Tie::File I doubt that Net::Netrc is not setup correctly.
This problem appears to be some buggy interaction between Tie::File and Net::Netrc
  • Comment on Re^2: Problem using Net::Netrc and Tie::File

Replies are listed 'Best First'.
Re^3: Problem using Net::Netrc and Tie::File
by hsinclai (Deacon) on Jun 12, 2004 at 23:54 UTC
    I believe .netrc should be 0600 (read and write by owner), not 0400 (read only). At least it is so in my docs.

    Since the script hangs at the point it is accessing the netrc file I can do no further error checking.
    .. this might not be a correct assumption..

    Is that a far-reaching enough sample of your actual script -- the host lookup method by itself doesn't really "do" anything. However if you do (attempt) an actual ftp login you would get the hang/lockup if for any reason the ftp data connection cannot be built, for firewall rules or whatever reason.. just a thought. The default timeout is probably like 60 seconds.. a veritable eternity..



      The script in the OP repoduces the problem. I believe the lookup method does access and read the ~/.netrc. Regarding the file mode for the .netrc file; the manpage for netrc on my HPUX 11 has the following:
      If the .netrc file contains password or account information for use other than for anonymous ftp, its owner must match the effective + user ID of the current process. Its read, write, and execute mode bi +ts for group and other must all be zero, and it must be readable by its owner. Otherwise, the file is ignored.
      The Net::Netrc page says read/write for owner or 0600. Either way (400||600), the script hangs if both Tie::File and Net::Netrc are both in the script. If I remove Tie::File from the above script it does not hang.

      Thanks

      Sweetblood