Id: 11248
Status: resolved
Left: 0 min
Queue: Verilog-Perl
Owner: WSNYDER <wsnyder@>
Requestors: jtseng@
Severity: Important
Broken in: 2.302
X Attachments
Verilog-Perl-2.310.diff
* Wed Jan 26 19:28:38 2005 (1.8k) by
Wed Jan 26 17:16:46 2005 guest - Ticket created
Subject: directories return in resolve_filename instead of filenames
resolve_filename can take either a filename or module. If a directory with the module name exists, then it is returned.
Example:
parent/top/top.v
Running the program in parent will return the "top" directory causing a input scanner error since it will try.
Running the program in any other directory will work. (assuming search paths are adjusted)
Solution:
Besides checking for "-r" we should make sure that it's not also a directory.
[jtseng@pagemill perl]$ diff -c Verilog-Perl-2.302/Getopt.pm Verilog-Perl-2.302-pasemi1/
*** Verilog-Perl-2.302/Getopt.pm 2004-11-10 09:56:43.000000000 -0800
--- Verilog-Perl-2.302-pasemi1/Getopt.pm 2005-01-26 14:03:55.000000000 -0800
***************
*** 309,315 ****
defined $filename or carp "%Error: Undefined filename,";
return $self->{_file_path_cache}{$filename} if defined $self->{_file_path_cache}{$filename};
! if (-r $filename) {
$self->{_file_path_cache}{$filename} = $filename;
$self->depend_files($filename);
return $filename;
--- 309,315 ----
defined $filename or carp "%Error: Undefined filename,";
return $self->{_file_path_cache}{$filename} if defined $self->{_file_path_cache}{$filename};
! if (-r $filename && (! -d $filename)) {
$self->{_file_path_cache}{$filename} = $filename;
$self->depend_files($filename);
return $filename;
***************
*** 324,330 ****
foreach my $postfix ("", @{$self->{libext}}) {
my $found = "$dir/$filename$postfix";
next if $checked{$found}; $checked{$found}=1; # -r can be quite slow
! if (-r $found) {
$self->{_file_path_cache}{$filename} = $found;
$self->depend_files($found);
return $found;
--- 324,330 ----
foreach my $postfix ("", @{$self->{libext}}) {
my $found = "$dir/$filename$postfix";
next if $checked{$found}; $checked{$found}=1; # -r can be quite slow
! if (-r $found && (! -d $found)) {
$self->{_file_path_cache}{$filename} = $found;
$self->depend_files($found);
return $found;
Wed Jan 26 19:28:38 2005 guest - Correspondence added
From: jtseng@
I've attached a better diff which correctly addresses the file caching
of directories.
-john
[guest - Wed Jan 26 17:16:46 2005]:
[text/x-patch 1.8k]
*** Verilog-Perl-2.310/Getopt.pm 2005-01-24 07:18:04.000000000 -0800
--- Verilog-Perl-2.310-pasemi/Getopt.pm 2005-01-26 16:20:06.000000000 -0800
***************
*** 312,318 ****
defined $filename or carp "%Error: Undefined filename,";
return $self->{_file_path_cache}{$filename} if defined $self->{_file_path_cache}{$filename};
! if (-r $filename) {
$self->{_file_path_cache}{$filename} = $filename;
$self->depend_files($filename);
return $filename;
--- 312,318 ----
defined $filename or carp "%Error: Undefined filename,";
return $self->{_file_path_cache}{$filename} if defined $self->{_file_path_cache}{$filename};
! if ((-r $filename) && (! -d $filename)) {
$self->{_file_path_cache}{$filename} = $filename;
$self->depend_files($filename);
return $filename;
***************
*** 324,332 ****
foreach my $dir (@{$self->incdir()}, @{$self->module_dir()}) {
next if $checked{$dir}; $checked{$dir}=1; # -r can be quite slow
1. Check each postfix added to the file
! foreach my $postfix ("", @{$self->{libext}}) {
my $found = "$dir/$filename$postfix";
! next if $checked{$found}; $checked{$found}=1; # -r can be quite slow
if (-r $found) {
$self->{_file_path_cache}{$filename} = $found;
$self->depend_files($found);
--- 324,335 ----
foreach my $dir (@{$self->incdir()}, @{$self->module_dir()}) {
next if $checked{$dir}; $checked{$dir}=1; # -r can be quite slow
1. Check each postfix added to the file
! # foreach my $postfix ("", @{$self->{libext}}) {
! foreach my $postfix (@{$self->{libext}}) { # remove "" for pasemi speedup only
my $found = "$dir/$filename$postfix";
! next if ($checked{$found} || (-d $found));
! $checked{$found}=1; # -r can be quite slow
!
if (-r $found) {
$self->{_file_path_cache}{$filename} = $found;
$self->depend_files($found);
Thu Jan 27 11:23:38 2005 WSNYDER - Correspondence added
Fixed in just-uploaded 2.311. Thanks much for giving a patch!
Thu Jan 27 11:23:39 2005 WSNYDER - Given to WSNYDER
Thu Jan 27 11:23:39 2005 WSNYDER - Status changed from 'new' to 'resolved'
The text was updated successfully, but these errors were encountered:
Author Name: Wilson Snyder (@wsnyder)
Original Redmine Issue: 123 from https://www.veripool.org
Original Date: 2005-01-26
This bug was cloned from Perl-RT, rt11248.
Email addresses have have been truncated.
Wed Jan 26 17:16:46 2005 guest - Ticket created
Wed Jan 26 19:28:38 2005 guest - Correspondence added
Thu Jan 27 11:23:38 2005 WSNYDER - Correspondence added
Thu Jan 27 11:23:39 2005 WSNYDER - Given to WSNYDER
Thu Jan 27 11:23:39 2005 WSNYDER - Status changed from 'new' to 'resolved'
The text was updated successfully, but these errors were encountered: