Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Verilog-Perl CPAN distribution.

Report information
The Basics
Id: 11248
Status: resolved
Priority: 0/
Queue: Verilog-Perl

People
Owner: wsnyder [...] wsnyder.org
Requestors: jtseng [...] pasemi.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.302
Fixed in: (no value)



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;
From: jtseng [...] pasemi.com
I've attached a better diff which correctly addresses the file caching of directories. -john [guest - Wed Jan 26 17:16:46 2005]: Show quoted text
> 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;
*** 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 # 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 # 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);
Fixed in just-uploaded 2.311. Thanks much for giving a patch!