s3u / capirca

Automatically exported from code.google.com/p/capirca
Apache License 2.0
0 stars 0 forks source link

policies with multiple "." in filename generate incorrect filter output name #8

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Copy the sample policy to another name having multiple dots in filename.

$ cp sample.pol sample.foo.pol

2. Run the generator.

$ ./aclgen.py

3. Verify that the file name does not include anything after the first dot.
 If you had two files names named similarly, one would be overwritten by
the other, resulting in only one policy instead of two generated.

Affected source code line is here:

fname = '%s%s' % (os.path.basename(input_file).split('.')[0], pol._SUFFIX)

What is the expected output? What do you see instead?

Expect to see:
$ ./aclgen.py 
writing ./filters/sample.foo.jcl
writing ./filters/sample.foo.acl
writing ./filters/sample.foo.ipt

Actually see:
$ ./aclgen.py 
writing ./filters/sample.jcl
writing ./filters/sample.ipt
writing ./filters/sample.acl

Please use labels and text to provide additional information.

dotfile, dotfiles, period, dots, dot

Original issue reported on code.google.com by kristian...@gmail.com on 26 Apr 2010 at 8:08

GoogleCodeExporter commented 9 years ago
I will commit a fix.  Please close ticket after you verify it to your 
satisfaction...

Original comment by kristian...@gmail.com on 26 Apr 2010 at 8:09

GoogleCodeExporter commented 9 years ago
Appears fixed.  Thanks. 
fname = '%s%s' % (".".join(os.path.basename(source).split('.')[0:-1]), suffix)

Original comment by watson@google.com on 12 Jul 2011 at 7:08