Bug#685265: syncmaildir: fails on '&' in Maildir names in EXCLUDE* ([smd-bug] internal error)

2012-10-04 Thread gregor herrmann
On Thu, 04 Oct 2012 13:18:01 +0200, Enrico Tassi wrote:

> > Is there something different for -pull
> > and -push with regard to EXCLUDE(_LOCAL)?
> Nothing but for the number of time the value is parsed by the shell.

I see.

> When you pull you do something like:
> 
>ssh host smd-server --exclude $EXCLUDE_REMOTE ...
> 
> and the remote smd-server passes the flag to mddiff. If you push, you
> directly call mddiff with the $EXCLUDE_LOCAL flag. 

Thanks for the explanation!

> For some reasons I
> did not dig into, one of the two commands asks the shell to parse the
> argument lists passed around twice. I tried a bit to use `eval` to
> unifor the things, but I decided it is better to fix the problem in
> another way ;-)

Might be a better headache prevention :)


Cheers,
gregor
 
-- 
 .''`.  Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
 : :' : Debian GNU/Linux user, admin, and developer  -  http://www.debian.org/
 `. `'  Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
   `-   NP: Neil Young: Are You Ready For The Country


signature.asc
Description: Digital signature


Bug#685265: syncmaildir: fails on '&' in Maildir names in EXCLUDE* ([smd-bug] internal error)

2012-10-04 Thread Enrico Tassi
On Thu, Oct 04, 2012 at 12:39:32PM +0200, gregor herrmann wrote:
> Ah, that might explain why it "works" (as in: I have the folders
> locally on the laptop but not on the server -- just checked again,
> they really are not there). Is there something different for -pull
> and -push with regard to EXCLUDE(_LOCAL)?

Nothing but for the number of time the value is parsed by the shell.
When you pull you do something like:

   ssh host smd-server --exclude $EXCLUDE_REMOTE ...

and the remote smd-server passes the flag to mddiff. If you push, you
directly call mddiff with the $EXCLUDE_LOCAL flag. For some reasons I
did not dig into, one of the two commands asks the shell to parse the
argument lists passed around twice. I tried a bit to use `eval` to
unifor the things, but I decided it is better to fix the problem in
another way ;-)

Cheers
-- 
Enrico Tassi


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#685265: syncmaildir: fails on '&' in Maildir names in EXCLUDE* ([smd-bug] internal error)

2012-10-04 Thread gregor herrmann
On Thu, 04 Oct 2012 12:04:56 +0200, Enrico Tassi wrote:

> > > I clearly understand your patch, it seems OK to me.
> > > And I'm indeed glad it works ;-)
> > I does, and I'm happily using smd since then :)
> I've been able to reproduce the bug. 

Excellent.

> The bad news is that your fix does
> not work. 

Oh, please don't tell this to my smd instance :)

> The folder you marked for exclusion is probably not excluded
> at all, since the ' is interpreted as part of the glob expression (at
> least by smd-pull).

Ah, that might explain why it "works" (as in: I have the folders
locally on the laptop but not on the server -- just checked again,
they really are not there). Is there something different for -pull
and -push with regard to EXCLUDE(_LOCAL)?
 
> The bug is clearly a consequence of the escaping madness of the shell.
> The bits of smd written in shell script have grown too much, and it is
> time to rewrite them in a less error prone language.

Right, shell escaping is a beast ...
 
> I think that the easiest workaround for you, if you want exclude the
> folder in question, is to revet your patch and replace & with %26 in
> the EXCLUDE_* glob expression (as you have to do with %20 for spaces).

Good hint, thanks.


Cheers,
gregor
 
-- 
 .''`.  Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
 : :' : Debian GNU/Linux user, admin, and developer  -  http://www.debian.org/
 `. `'  Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
   `-   BOFH excuse #148:  Insert coin for new game 


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#685265: syncmaildir: fails on '&' in Maildir names in EXCLUDE* ([smd-bug] internal error)

2012-10-04 Thread Enrico Tassi
On Mon, Oct 01, 2012 at 06:00:20PM +0200, gregor herrmann wrote:
> > > > The attached patch brings me over this failure; no idea if it has any
> > > > side effects, I haven't dared to run smd* without --dry-run :)
> > > Good news: smd is running flawlessly for me since a week.
> > I clearly understand your patch, it seems OK to me.
> > And I'm indeed glad it works ;-)
> I does, and I'm happily using smd since then :)

I've been able to reproduce the bug. The bad news is that your fix does
not work. The folder you marked for exclusion is probably not excluded
at all, since the ' is interpreted as part of the glob expression (at
least by smd-pull).

The bug is clearly a consequence of the escaping madness of the shell.
The bits of smd written in shell script have grown too much, and it is
time to rewrite them in a less error prone language.

I think that the easiest workaround for you, if you want exclude the
folder in question, is to revet your patch and replace & with %26 in
the EXCLUDE_* glob expression (as you have to do with %20 for spaces).

Cheers
-- 
Enrico Tassi


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#685265: syncmaildir: fails on '&' in Maildir names in EXCLUDE* ([smd-bug] internal error)

2012-10-01 Thread gregor herrmann
On Mon, 01 Oct 2012 13:42:22 +0200, Enrico Tassi wrote:

> On Sun, Aug 26, 2012 at 03:48:23PM +0200, gregor herrmann wrote:
> > On Sun, 19 Aug 2012 01:56:49 +0200, gregor herrmann wrote:
> > > The attached patch brings me over this failure; no idea if it has any
> > > side effects, I haven't dared to run smd* without --dry-run :)
> > Good news: smd is running flawlessly for me since a week.
> Sorry for the late reply.
> I clearly understand your patch, it seems OK to me.
> And I'm indeed glad it works ;-)

I does, and I'm happily using smd since then :)
 
> But I was not able to reproduce the bug.
> Could you tell me more about your setup?

Hm, it's been some time, let me try to remember what I did.

This was the very start, before any actual sync. I had just installed
smd and added a minimal config with SERVERNAME CLIENTNAME MAILBOX and
(in some variations but that's what I'm using now:)

EXCLUDE_LOCAL="... Maildir/.MiscArchive* ..."

And in these MiscArchive tree there are 3 folders which contain a '&',
like:

% ls -1d ~/Maildir/.MiscArchive*
/home/gregoa/Maildir/.MiscArchive
/home/gregoa/Maildir/.MiscArchive.bar
/home/gregoa/Maildir/.MiscArchive.foo
/home/gregoa/Maildir/.MiscArchive.x&g
/home/gregoa/Maildir/.MiscArchive.y&g
/home/gregoa/Maildir/.MiscArchive.z&g

% ls -1 ~/Maildir/.MiscArchive.x\&g
cur
new
tmp

Then I got the failure when running
`smd-push --dry-run --verbose'.

And one of the logs (sorry for not keeping it, I was too much in
"let's try to get this working" mode) had 3 errors, probably one for
each of the '&' folders, that was like "sh: can't find command g" or
similar ...

Hm, something like

zsh:

% echo x&g
x
[1] 8328
[1]  + 8328 done   echo x
zsh: command not found: g

bash:

$ echo x&g
[1] 8591
x
bash: g: command not found
[1]+  Doneecho x

(In case that's relevant, I'm using zsh as my interactive shell, and
/bin/sh points to bash; but I guess this will fail in all shells :))


Does this help? Sorry for not having gathered more information right
when this happened ...


Cheers,
gregor
 
-- 
 .''`.  Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
 : :' : Debian GNU/Linux user, admin, and developer  -  http://www.debian.org/
 `. `'  Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
   `-   NP: Pink Floyd: Another brick in the wall 2


signature.asc
Description: Digital signature


Bug#685265: syncmaildir: fails on '&' in Maildir names in EXCLUDE* ([smd-bug] internal error)

2012-10-01 Thread Enrico Tassi
On Sun, Aug 26, 2012 at 03:48:23PM +0200, gregor herrmann wrote:
> On Sun, 19 Aug 2012 01:56:49 +0200, gregor herrmann wrote:
> 
> > The attached patch brings me over this failure; no idea if it has any
> > side effects, I haven't dared to run smd* without --dry-run :)
> 
> Good news: smd is running flawlessly for me since a week.

Sorry for the late reply.
I clearly understand your patch, it seems OK to me.
And I'm indeed glad it works ;-)

But I was not able to reproduce the bug.
Could you tell me more about your setup?

Cheers
-- 
Enrico Tassi


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#685265: syncmaildir: fails on '&' in Maildir names in EXCLUDE* ([smd-bug] internal error)

2012-08-26 Thread gregor herrmann
On Sun, 19 Aug 2012 01:56:49 +0200, gregor herrmann wrote:

> The attached patch brings me over this failure; no idea if it has any
> side effects, I haven't dared to run smd* without --dry-run :)

Good news: smd is running flawlessly for me since a week.


Cheers,
gregor
 
-- 
 .''`.  Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
 : :' : Debian GNU/Linux user, admin, and developer  -  http://www.debian.org/
 `. `'  Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
   `-   NP: Dire Straits: Solid Rock


signature.asc
Description: Digital signature


Bug#685265: syncmaildir: fails on '&' in Maildir names in EXCLUDE* ([smd-bug] internal error)

2012-08-18 Thread gregor herrmann
Package: syncmaildir
Severity: important
Version: 1.2.5-1
Tags: patch

smd-push --dry-run --verbose exploded and ask me to send the
following message:

#v+
This email reports an internal error, something that should never happen.
To help the developers to find and solve the issue, please send this email.
If you are able to reproduce the bug, please attach a detailed description
of what you do to help the developers to experience the same malfunctioning.

smd-version: 1.2.5
error-message: Error parsing ""
backtrace:
stack traceback:
/usr/share/lua/5.1/syncmaildir.lua:683: in function 
'log_internal_error_tags'
/usr/share/lua/5.1/syncmaildir.lua:124: in function 
'log_internal_error_and_fail'
/usr/share/lua/5.1/syncmaildir.lua:535: in function 'parse'
/usr/bin/smd-client:443: in function 'execute'
/usr/bin/smd-client:643: in function 
[C]: in function 'xpcall'
/usr/share/lua/5.1/syncmaildir.lua:689: in function 'parachute'
/usr/bin/smd-client:719: in main chunk
[C]: ?
#v-

I tracked down the reason to maildir names that contain "&"
characters, and that I had in my EXCLUDE_LOCAL (no matter if
literally or included by a * glob).

The attached patch brings me over this failure; no idea if it has any
side effects, I haven't dared to run smd* without --dry-run :)


Cheers,
gregor

-- 
 .''`.  Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
 : :' : Debian GNU/Linux user, admin, and developer  -  http://www.debian.org/
 `. `'  Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
   `-   NP: Wolf Biermann: Comandante Che Guevara
--- unpacked/usr/share/syncmaildir/smd-common	2012-06-11 15:09:55.0 +0200
+++ /usr/share/syncmaildir/smd-common	2012-08-19 01:52:50.041505225 +0200
@@ -417,10 +417,10 @@
 			EXCLUDE_REMOTE="$EXCLUDE"
 	fi
 	for e in $EXCLUDE_LOCAL; do
-			LOCALEXCLUDE="$LOCALEXCLUDE --exclude $e"
+			LOCALEXCLUDE="$LOCALEXCLUDE --exclude '$e'"
 	done
 	for e in $EXCLUDE_REMOTE; do
-			REMOTEEXCLUDE="$REMOTEEXCLUDE --exclude $e"
+			REMOTEEXCLUDE="$REMOTEEXCLUDE --exclude '$e'"
 	done
 
 	# check for local synchronization


signature.asc
Description: Digital signature