You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2006/06/04 14:54:17 UTC
[Bug 4935] New: Wrong mode for lock files when lock_method => flock
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4935
Summary: Wrong mode for lock files when lock_method => flock
Product: Spamassassin
Version: SVN Trunk (Latest Devel Version)
Platform: Other
OS/Version: other
Status: NEW
Severity: normal
Priority: P5
Component: Libraries
AssignedTo: dev@spamassassin.apache.org
ReportedBy: radek@pld-linux.org
$ ls -l .spamassassin|awk '/whitelist/{print $1 " " $8}'
-rw------- auto-whitelist
-rw-rw-rw- auto-whitelist.mutex
$ rm .spamassassin/auto-whitelist*
$ LANG=C ./saumask.pl 0770
auto-whitelist: open of auto-whitelist file failed: auto-whitelist: cannot open
auto_whitelist_path /home/users/radek/.spamassassin/auto-whitelist: No such file
or directory
$ ls -l .spamassassin|awk '/whitelist/{print $1 " " $8}'
-r--rw--w- auto-whitelist.mutex
saumask.pl attached.
Summary: SA ignores user-set umask (naughty), sets umask(0) at one point (very
naughty) and sets umask(auto_whitelist_file_mode ^ 0770) (WTF is that XOR doing
out there?).
Attached patch (against current trunk):
* kills umask(0)
* sets file permissions to auto_whitelist_file_mode (using umask(~$mode))
* still ignores user-set umask (not really a problem, as default
auto_whitelist_file_mode is 0700
* uses 0700 instead of '0700'
* kills one goto, (hopefully) making the function more readable
* adds some vim lines.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4935] Wrong mode for lock files when lock_method => flock
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4935
------- Additional Comments From jm@jmason.org 2006-06-20 17:59 -------
why does it include this change?
Index: lib/Mail/SpamAssassin/ArchiveIterator.pm
===================================================================
--- lib/Mail/SpamAssassin/ArchiveIterator.pm (wersja 415021)
+++ lib/Mail/SpamAssassin/ArchiveIterator.pm (kopia robocza)
@@ -292,7 +292,7 @@
}
# non-forking model (generally sa-learn), everything in a single process
- if ($self->{opt_j} == 0) {
+ if ($self->{opt_j} < 2) {
my $messages;
# message-array
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4935] Wrong mode for lock files when lock_method => flock
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4935
radek@pld-linux.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #3553 is|0 |1
obsolete| |
------- Additional Comments From radek@pld-linux.org 2006-06-20 18:42 -------
Created an attachment (id=3555)
--> (http://issues.apache.org/SpamAssassin/attachment.cgi?id=3555&action=view)
remove vim modelines and unrelated ArchiveIterator change
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4935] Wrong mode for lock files when lock_method => flock
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4935
radek@pld-linux.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #3543 is|0 |1
obsolete| |
------- Additional Comments From radek@pld-linux.org 2006-06-04 13:20 -------
Created an attachment (id=3544)
--> (http://issues.apache.org/SpamAssassin/attachment.cgi?id=3544&action=view)
Better fix
Changes to previous patch:
* change auto_whitelist_file_mode to 0600, not 0700 (why executable?)
* get rid of oct from Locker::UnixNFSSafe
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4935] [review] Wrong mode for lock files when lock_method => flock
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4935
felicity@apache.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Wrong mode for lock files |[review] Wrong mode for lock
|when lock_method => flock |files when lock_method =>
| |flock
Status Whiteboard| |needs 1 vote
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4935] [review] Wrong mode for lock files when lock_method => flock
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4935
spamassassin@dostech.ca changed:
What |Removed |Added
----------------------------------------------------------------------------
Status Whiteboard|needs 1 vote |can be committed
------- Additional Comments From spamassassin@dostech.ca 2006-07-09 22:43 -------
+1 on 3555
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4935] Wrong mode for lock files when lock_method => flock
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4935
------- Additional Comments From felicity@apache.org 2006-06-20 18:08 -------
(In reply to comment #5)
> why does it include this change?
>
> Index: lib/Mail/SpamAssassin/ArchiveIterator.pm
[...]
That's a good question since the AI change isn't related to the bug. That "==
0" to "< 2" change is also going to get a -1 from me since it breaks AI... (see
the -j POD at the top of the module)
I'd also recommend not putting in the vim bits unless others feel it's ok. (I
happen to use vim as well, but it sets a precedent that we may not want to go into.)
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4935] Wrong mode for lock files when lock_method => flock
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4935
------- Additional Comments From radek@pld-linux.org 2006-06-04 12:55 -------
Created an attachment (id=3543)
--> (http://issues.apache.org/SpamAssassin/attachment.cgi?id=3543&action=view)
Fix
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4935] Wrong mode for lock files when lock_method => flock
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4935
radek@pld-linux.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #3544 is|0 |1
obsolete| |
------- Additional Comments From radek@pld-linux.org 2006-06-20 10:55 -------
Created an attachment (id=3553)
--> (http://issues.apache.org/SpamAssassin/attachment.cgi?id=3553&action=view)
Less intrusive version, maybe someone'll look at it finally.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4935] Wrong mode for lock files when lock_method => flock
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4935
------- Additional Comments From radek@pld-linux.org 2006-06-20 18:15 -------
(In reply to comment #5)
> why does it include this change?
[...]
> - if ($self->{opt_j} == 0) {
> + if ($self->{opt_j} < 2) {
By mistake.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4935] Wrong mode for lock files when lock_method => flock
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4935
------- Additional Comments From jm@jmason.org 2006-06-20 18:23 -------
cool. I'm +1 on the rest (in theory -- obviously there'd need to be a patch
before that vote means anything ;)
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4935] Wrong mode for lock files when lock_method => flock
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4935
felicity@apache.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|Undefined |3.1.4
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4935] Wrong mode for lock files when lock_method => flock
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4935
------- Additional Comments From jm@jmason.org 2006-06-20 19:04 -------
cool, I can go for that. +1
btw, the "0700" idea was for cases where there may be some kind of "lock
directory" model; 0600 obviously doesn't make much sense there. but that's
really an abstract concept and no need to worry about it.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4935] [review] Wrong mode for lock files when lock_method => flock
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4935
felicity@apache.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
------- Additional Comments From felicity@apache.org 2006-07-10 00:35 -------
3.1:
Sending lib/Mail/SpamAssassin/DBBasedAddrList.pm
Sending lib/Mail/SpamAssassin/Locker/Flock.pm
Sending lib/Mail/SpamAssassin/Locker/UnixNFSSafe.pm
Sending lib/Mail/SpamAssassin/Plugin/AWL.pm
Transmitting file data ....
Committed revision 420381.
3.2:
Sending lib/Mail/SpamAssassin/DBBasedAddrList.pm
Sending lib/Mail/SpamAssassin/Locker/Flock.pm
Sending lib/Mail/SpamAssassin/Locker/UnixNFSSafe.pm
Sending lib/Mail/SpamAssassin/Plugin/AWL.pm
Transmitting file data ....
Committed revision 420382.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4935] Wrong mode for lock files when lock_method => flock
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4935
------- Additional Comments From radek@pld-linux.org 2006-06-20 18:21 -------
(In reply to comment #6)
> I'd also recommend not putting in the vim bits unless others feel it's ok. (I
> happen to use vim as well, but it sets a precedent that we may not want to go
into.)
There's lot of mixed tabs / spaces indentation in SA, which is nasty; code looks
ugly with tab size other than 8 (my default is 4). SA seems to use sw=2 and
mostly spaces instead of tabs, so I've inserted this setting. But you're right,
that's a topic for a separate bug / patch.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4935] Wrong mode for lock files when lock_method => flock
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4935
------- Additional Comments From felicity@apache.org 2006-06-20 23:47 -------
+1
I think it's generally good, though I would have written:
+ tie %{ $self->{accum} }, $dbm_module, $path, $mod2,
+ oct($main->{conf}->{auto_whitelist_file_mode})
+ or do {
+ my $err = $!; # might get overwritten later
+ if ($self->{is_locked}) {
+ $self->{main}->{locker}->safe_unlock($self->{locked_file});
+ $self->{is_locked} = 0;
+ }
+ die "auto-whitelist: cannot open auto_whitelist_path $path: $err\n";
+ };
to be similar to:
if (! tie .... ) {
...
}
since that would match how things are done in the rest of the code.
It's a trivial change though, so we can change it later. :)
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4935] Wrong mode for lock files when lock_method => flock
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4935
------- Additional Comments From radek@pld-linux.org 2006-06-04 12:54 -------
Created an attachment (id=3542)
--> (http://issues.apache.org/SpamAssassin/attachment.cgi?id=3542&action=view)
Test for this bug.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.