[PATCH] Fix the smblcient utimes test in Europe

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Fix the smblcient utimes test in Europe

Samba - samba-technical mailing list
Hi,

some of us life in a different timezone!

The attched patch fixes the test.


Please review and push if OK.


Thanks,


        Andreas

--
Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             [hidden email]
www.samba.org

0001-s3-tests-Fix-the-smblcient-utimes-test-in-Europe.patch (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Fix the smblcient utimes test in Europe

Samba - samba-technical mailing list
On Thu, Oct 19, 2017 at 06:05:27PM +0200, Andreas Schneider via samba-technical wrote:
> Hi,
>
> some of us life in a different timezone!
>
> The attched patch fixes the test.
>
>
> Please review and push if OK.

Sorry, I thought of setting env TZ before that test,
but then worried it might 'stick' and cause other
tests to fail.

Thanks for the portable fix. RB+.

Cheers,

Jeremy.

>
>
> Andreas
>
> --
> Andreas Schneider                   GPG-ID: CC014E3D
> Samba Team                             [hidden email]
> www.samba.org

> From 5fa785c3f2f1297ce947b591e4945361039db103 Mon Sep 17 00:00:00 2001
> From: Andreas Schneider <[hidden email]>
> Date: Thu, 19 Oct 2017 18:03:27 +0200
> Subject: [PATCH] s3:tests: Fix the smblcient utimes test in Europe
>
> Signed-off-by: Andreas Schneider <[hidden email]>
> ---
>  source3/script/tests/test_smbclient_s3.sh | 18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
> index e402a2c51fe..191f3941fb7 100755
> --- a/source3/script/tests/test_smbclient_s3.sh
> +++ b/source3/script/tests/test_smbclient_s3.sh
> @@ -1442,11 +1442,11 @@ EOF
>  
>      # Now, we should have 2 identical create_time, write_time, change_time
>      # values, but one access_time of Jan  1 05:10:20 AM.
> -    out=`echo "$out" | sort | uniq`
> -    num_create=`echo "$out" | grep 'create_time:' | wc -l`
> -    num_access=`echo "$out" | grep 'access_time:' | wc -l`
> -    num_write=`echo "$out" | grep 'write_time:' | wc -l`
> -    num_change=`echo "$out" | grep 'change_time:' | wc -l`
> +    out_sorted=`echo "$out" | sort | uniq`
> +    num_create=`echo "$out_sorted" | grep -c 'create_time:'`
> +    num_access=`echo "$out_sorted" | grep -c 'access_time:'`
> +    num_write=`echo "$out_sorted" | grep -c 'write_time:'`
> +    num_change=`echo "$out_sorted" | grep -c 'change_time:'`
>      if [ "$num_create" != "1" ]; then
>          echo "failed - should only get one create_time $out"
>          false
> @@ -1467,11 +1467,15 @@ EOF
>          false
>          return
>      fi
> -    echo "$out" | grep 'access_time:.*Sun Jan.*1 05:10:20 AM 2017'
> +
> +    # This could be: Sun Jan  1 05:10:20 AM 2017
> +    # or           : Sun Jan  1 05:10:20 2017 CET
> +    echo "$out" | grep 'access_time:.*Sun Jan.*1 05:10:20 .*2017.*'
>      ret=$?
>      if [ $ret -ne 0 ] ; then
>         echo "$out"
> -       echo "failed - should get access_time:    Sun Jan  1 05:10:20 AM 2017"
> +       echo
> +       echo "failed - should get access_time:    Sun Jan  1 05:10:20 [AM] 2017"
>         false
>         return
>      fi
> --
> 2.14.2
>


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Fix the smblcient utimes test in Europe

Samba - samba-technical mailing list
In reply to this post by Samba - samba-technical mailing list
On Thu, 2017-10-19 at 18:05 +0200, Andreas Schneider via samba-
technical wrote:
> Hi,
>
> some of us life in a different timezone!
>
> The attched patch fixes the test.
>
>
> Please review and push if OK.

G'Day Andreas and Jeremy,

Some of us live in New Zealand as well.  Could one of you please rework
to test to set a common timezone?

If I run it locally, I get:

UNEXPECTED(failure): samba3.blackbox.smbclient_s3.NT1.crypt
(nt4_dc).utimes(nt4_dc)
REASON: Exception: Exception: CLI_FORCE_INTERACTIVE=yes
/data/samba/git/samba7/bin/smbclient -Uabartlet%localntdc2pass
//LOCALNT4DC2/tmp -I 127.0.0.3 --
configfile=/data/samba/git/samba7/st/client/client.conf -mNT1 -e
Try "help" to get a list of possible commands.
smb: \> del utimes_test
NT_STATUS_NO_SUCH_FILE listing \utimes_test
smb: \> put  /data/samba/git/samba7/bin/smbclient utimes_test
putting file /data/samba/git/samba7/bin/smbclient as \utimes_test
(29861.4 kb/s) (average 29861.7 kb/s)
smb: \> allinfo utimes_test
altname: US5MWC~R
create_time:    Tue Dec  5 13:02:29 2017 NZDT
access_time:    Tue Dec  5 13:02:29 2017 NZDT
write_time:     Tue Dec  5 13:02:29 2017 NZDT
change_time:    Tue Dec  5 13:02:29 2017 NZDT
attributes: A (20)
stream: [::$DATA], 305784 bytes
smb: \> utimes utimes_test -1 17:01:01-05:10:20 -1 -1
smb: \> allinfo utimes_test
altname: US5MWC~R
create_time:    Tue Dec  5 13:02:29 2017 NZDT
access_time:    Sun Jan  1 06:10:20 2017 NZDT
write_time:     Tue Dec  5 13:02:29 2017 NZDT
change_time:    Tue Dec  5 13:02:29 2017 NZDT
attributes: A (20)
stream: [::$DATA], 305784 bytes
smb: \> del utimes_test
smb: \> quit

failed - should get access_time:    Sun Jan  1 05:10:20 [AM] 2017
envlog: SMBD LOG of: LOCALNT4DC2


(I didn't notice until now as our cloud boxen use GMT and we do almost
all our testing on those).

Thanks,

Andrew Bartlett

--
Andrew Bartlett
https://samba.org/~abartlet/
Authentication Developer, Samba Team         https://samba.org
Samba Development and Support, Catalyst IT  
https://catalyst.net.nz/services/samba





Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Fix the smblcient utimes test in Europe

Samba - samba-technical mailing list
On Tue, Dec 05, 2017 at 01:11:00PM +1300, Andrew Bartlett wrote:

> On Thu, 2017-10-19 at 18:05 +0200, Andreas Schneider via samba-
> technical wrote:
> > Hi,
> >
> > some of us life in a different timezone!
> >
> > The attched patch fixes the test.
> >
> >
> > Please review and push if OK.
>
> G'Day Andreas and Jeremy,
>
> Some of us live in New Zealand as well.  Could one of you please rework
> to test to set a common timezone?

Yeah, should probably temporarily set TZ=UTC for that test
I think.

> If I run it locally, I get:
>
> UNEXPECTED(failure): samba3.blackbox.smbclient_s3.NT1.crypt
> (nt4_dc).utimes(nt4_dc)
> REASON: Exception: Exception: CLI_FORCE_INTERACTIVE=yes
> /data/samba/git/samba7/bin/smbclient -Uabartlet%localntdc2pass
> //LOCALNT4DC2/tmp -I 127.0.0.3 --
> configfile=/data/samba/git/samba7/st/client/client.conf -mNT1 -e
> Try "help" to get a list of possible commands.
> smb: \> del utimes_test
> NT_STATUS_NO_SUCH_FILE listing \utimes_test
> smb: \> put  /data/samba/git/samba7/bin/smbclient utimes_test
> putting file /data/samba/git/samba7/bin/smbclient as \utimes_test
> (29861.4 kb/s) (average 29861.7 kb/s)
> smb: \> allinfo utimes_test
> altname: US5MWC~R
> create_time:    Tue Dec  5 13:02:29 2017 NZDT
> access_time:    Tue Dec  5 13:02:29 2017 NZDT
> write_time:     Tue Dec  5 13:02:29 2017 NZDT
> change_time:    Tue Dec  5 13:02:29 2017 NZDT
> attributes: A (20)
> stream: [::$DATA], 305784 bytes
> smb: \> utimes utimes_test -1 17:01:01-05:10:20 -1 -1
> smb: \> allinfo utimes_test
> altname: US5MWC~R
> create_time:    Tue Dec  5 13:02:29 2017 NZDT
> access_time:    Sun Jan  1 06:10:20 2017 NZDT
> write_time:     Tue Dec  5 13:02:29 2017 NZDT
> change_time:    Tue Dec  5 13:02:29 2017 NZDT
> attributes: A (20)
> stream: [::$DATA], 305784 bytes
> smb: \> del utimes_test
> smb: \> quit
>
> failed - should get access_time:    Sun Jan  1 05:10:20 [AM] 2017
> envlog: SMBD LOG of: LOCALNT4DC2
>
>
> (I didn't notice until now as our cloud boxen use GMT and we do almost
> all our testing on those).
>
> Thanks,
>
> Andrew Bartlett
>
> --
> Andrew Bartlett
> https://samba.org/~abartlet/
> Authentication Developer, Samba Team         https://samba.org
> Samba Development and Support, Catalyst IT  
> https://catalyst.net.nz/services/samba
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Fix the smblcient utimes test in Europe

Samba - samba-technical mailing list
In reply to this post by Samba - samba-technical mailing list
On Tue, Dec 05, 2017 at 01:11:00PM +1300, Andrew Bartlett wrote:

> On Thu, 2017-10-19 at 18:05 +0200, Andreas Schneider via samba-
> technical wrote:
> > Hi,
> >
> > some of us life in a different timezone!
> >
> > The attched patch fixes the test.
> >
> >
> > Please review and push if OK.
>
> G'Day Andreas and Jeremy,
>
> Some of us live in New Zealand as well.  Could one of you please rework
> to test to set a common timezone?
Can you try this to see if it fixes it ?

look (723 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Fix the smblcient utimes test in Europe

Samba - samba-technical mailing list
On Mon, 2017-12-04 at 17:02 -0800, Jeremy Allison wrote:

> On Tue, Dec 05, 2017 at 01:11:00PM +1300, Andrew Bartlett wrote:
> > On Thu, 2017-10-19 at 18:05 +0200, Andreas Schneider via samba-
> > technical wrote:
> > > Hi,
> > >
> > > some of us life in a different timezone!
> > >
> > > The attched patch fixes the test.
> > >
> > >
> > > Please review and push if OK.
> >
> > G'Day Andreas and Jeremy,
> >
> > Some of us live in New Zealand as well.  Could one of you please rework
> > to test to set a common timezone?
>
> Can you try this to see if it fixes it ?

That works for me.

Thanks!

Andrew Bartlett

--
Andrew Bartlett
https://samba.org/~abartlet/
Authentication Developer, Samba Team         https://samba.org
Samba Development and Support, Catalyst IT  
https://catalyst.net.nz/services/samba





Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Fix the smblcient utimes test in Europe

Samba - samba-technical mailing list
On Tue, Dec 05, 2017 at 02:12:38PM +1300, Andrew Bartlett wrote:

> On Mon, 2017-12-04 at 17:02 -0800, Jeremy Allison wrote:
> > On Tue, Dec 05, 2017 at 01:11:00PM +1300, Andrew Bartlett wrote:
> > > On Thu, 2017-10-19 at 18:05 +0200, Andreas Schneider via samba-
> > > technical wrote:
> > > > Hi,
> > > >
> > > > some of us life in a different timezone!
> > > >
> > > > The attched patch fixes the test.
> > > >
> > > >
> > > > Please review and push if OK.
> > >
> > > G'Day Andreas and Jeremy,
> > >
> > > Some of us live in New Zealand as well.  Could one of you please rework
> > > to test to set a common timezone?
> >
> > Can you try this to see if it fixes it ?
>
> That works for me.
>
> Thanks!
git-am fix for master. Push if happy !

0001-s3-test_smbclient_s3-Correctly-set-and-unset-TZ-vari.patch (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Fix the smblcient utimes test in Europe

Samba - samba-technical mailing list
On Mon, 2017-12-04 at 17:15 -0800, Jeremy Allison wrote:
>
> git-am fix for master. Push if happy !

Thanks, done!

Andrew Bartlett

--
Andrew Bartlett
https://samba.org/~abartlet/
Authentication Developer, Samba Team         https://samba.org
Samba Development and Support, Catalyst IT  
https://catalyst.net.nz/services/samba





Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Fix the smblcient utimes test in Europe

Samba - samba-technical mailing list
In reply to this post by Samba - samba-technical mailing list
On ma, 04 joulu 2017, Jeremy Allison via samba-technical wrote:

> On Tue, Dec 05, 2017 at 02:12:38PM +1300, Andrew Bartlett wrote:
> > On Mon, 2017-12-04 at 17:02 -0800, Jeremy Allison wrote:
> > > On Tue, Dec 05, 2017 at 01:11:00PM +1300, Andrew Bartlett wrote:
> > > > On Thu, 2017-10-19 at 18:05 +0200, Andreas Schneider via samba-
> > > > technical wrote:
> > > > > Hi,
> > > > >
> > > > > some of us life in a different timezone!
> > > > >
> > > > > The attched patch fixes the test.
> > > > >
> > > > >
> > > > > Please review and push if OK.
> > > >
> > > > G'Day Andreas and Jeremy,
> > > >
> > > > Some of us live in New Zealand as well.  Could one of you please rework
> > > > to test to set a common timezone?
> > >
> > > Can you try this to see if it fixes it ?
> >
> > That works for me.
> >
> > Thanks!
>
> git-am fix for master. Push if happy !

> From 92622274c00cedce923c805b697ac9a75f375e24 Mon Sep 17 00:00:00 2001
> From: Jeremy Allison <[hidden email]>
> Date: Mon, 4 Dec 2017 17:13:43 -0800
> Subject: [PATCH] s3: test_smbclient_s3: Correctly set and unset TZ variable
>  for test.
>
> Signed-off-by: Jeremy Allison <[hidden email]>
> ---
>  source3/script/tests/test_smbclient_s3.sh | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
> index d98da0dd260..84f6ef5892e 100755
> --- a/source3/script/tests/test_smbclient_s3.sh
> +++ b/source3/script/tests/test_smbclient_s3.sh
> @@ -1419,6 +1419,10 @@ test_utimes()
>  {
>      tmpfile=$PREFIX/smbclient_interactive_prompt_commands
>  
> +    saved_TZ="$TZ"
> +    TZ=UTC
> +    export TZ
> +
This has saved_TZ.

>      cat > $tmpfile <<EOF
>  del utimes_test
>  put ${SMBCLIENT} utimes_test
> @@ -1433,6 +1437,12 @@ EOF
>      out=`eval $cmd`
>      ret=$?
>  
> +    if [ -n "$SAVED_TZ" ] ; then
> + export TZ="$SAVED_TZ"
> +    else
> + unset TZ
> +    fi
> +
And here you deal with SAVED_TZ (notice all caps).

So TZ is not preserved.

>      if [ $ret != 0 ] ; then
>   echo "$out"
>   echo "failed utimes test with output $ret"
> --
> 2.15.0.531.g2ccb3012c9-goog
>


--
/ Alexander Bokovoy

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Fix the smblcient utimes test in Europe

Samba - samba-technical mailing list
On Tue, Dec 05, 2017 at 11:31:04AM +0200, Alexander Bokovoy wrote:

> On ma, 04 joulu 2017, Jeremy Allison via samba-technical wrote:
> > On Tue, Dec 05, 2017 at 02:12:38PM +1300, Andrew Bartlett wrote:
> > > On Mon, 2017-12-04 at 17:02 -0800, Jeremy Allison wrote:
> > > > On Tue, Dec 05, 2017 at 01:11:00PM +1300, Andrew Bartlett wrote:
> > > > > On Thu, 2017-10-19 at 18:05 +0200, Andreas Schneider via samba-
> > > > > technical wrote:
> > > > > > Hi,
> > > > > >
> > > > > > some of us life in a different timezone!
> > > > > >
> > > > > > The attched patch fixes the test.
> > > > > >
> > > > > >
> > > > > > Please review and push if OK.
> > > > >
> > > > > G'Day Andreas and Jeremy,
> > > > >
> > > > > Some of us live in New Zealand as well.  Could one of you please rework
> > > > > to test to set a common timezone?
> > > >
> > > > Can you try this to see if it fixes it ?
> > >
> > > That works for me.
> > >
> > > Thanks!
> >
> > git-am fix for master. Push if happy !
>
> > From 92622274c00cedce923c805b697ac9a75f375e24 Mon Sep 17 00:00:00 2001
> > From: Jeremy Allison <[hidden email]>
> > Date: Mon, 4 Dec 2017 17:13:43 -0800
> > Subject: [PATCH] s3: test_smbclient_s3: Correctly set and unset TZ variable
> >  for test.
> >
> > Signed-off-by: Jeremy Allison <[hidden email]>
> > ---
> >  source3/script/tests/test_smbclient_s3.sh | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> >
> > diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
> > index d98da0dd260..84f6ef5892e 100755
> > --- a/source3/script/tests/test_smbclient_s3.sh
> > +++ b/source3/script/tests/test_smbclient_s3.sh
> > @@ -1419,6 +1419,10 @@ test_utimes()
> >  {
> >      tmpfile=$PREFIX/smbclient_interactive_prompt_commands
> >  
> > +    saved_TZ="$TZ"
> > +    TZ=UTC
> > +    export TZ
> > +
> This has saved_TZ.
>
> >      cat > $tmpfile <<EOF
> >  del utimes_test
> >  put ${SMBCLIENT} utimes_test
> > @@ -1433,6 +1437,12 @@ EOF
> >      out=`eval $cmd`
> >      ret=$?
> >  
> > +    if [ -n "$SAVED_TZ" ] ; then
> > + export TZ="$SAVED_TZ"
> > +    else
> > + unset TZ
> > +    fi
> > +
> And here you deal with SAVED_TZ (notice all caps).
>
> So TZ is not preserved.
Aaaaarggggh ! Thanks Alexander (I am a moron :-).

Can you review this and make sure I didn't screw
up again ?

Thanks,

        Jeremy.

0001-s3-test_smbclient_s3-Fix-restore-of-TZ.patch (876 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Fix the smblcient utimes test in Europe

Samba - samba-technical mailing list
On ti, 05 joulu 2017, Jeremy Allison wrote:

> On Tue, Dec 05, 2017 at 11:31:04AM +0200, Alexander Bokovoy wrote:
> > On ma, 04 joulu 2017, Jeremy Allison via samba-technical wrote:
> > > On Tue, Dec 05, 2017 at 02:12:38PM +1300, Andrew Bartlett wrote:
> > > > On Mon, 2017-12-04 at 17:02 -0800, Jeremy Allison wrote:
> > > > > On Tue, Dec 05, 2017 at 01:11:00PM +1300, Andrew Bartlett wrote:
> > > > > > On Thu, 2017-10-19 at 18:05 +0200, Andreas Schneider via samba-
> > > > > > technical wrote:
> > > > > > > Hi,
> > > > > > >
> > > > > > > some of us life in a different timezone!
> > > > > > >
> > > > > > > The attched patch fixes the test.
> > > > > > >
> > > > > > >
> > > > > > > Please review and push if OK.
> > > > > >
> > > > > > G'Day Andreas and Jeremy,
> > > > > >
> > > > > > Some of us live in New Zealand as well.  Could one of you please rework
> > > > > > to test to set a common timezone?
> > > > >
> > > > > Can you try this to see if it fixes it ?
> > > >
> > > > That works for me.
> > > >
> > > > Thanks!
> > >
> > > git-am fix for master. Push if happy !
> >
> > > From 92622274c00cedce923c805b697ac9a75f375e24 Mon Sep 17 00:00:00 2001
> > > From: Jeremy Allison <[hidden email]>
> > > Date: Mon, 4 Dec 2017 17:13:43 -0800
> > > Subject: [PATCH] s3: test_smbclient_s3: Correctly set and unset TZ variable
> > >  for test.
> > >
> > > Signed-off-by: Jeremy Allison <[hidden email]>
> > > ---
> > >  source3/script/tests/test_smbclient_s3.sh | 10 ++++++++++
> > >  1 file changed, 10 insertions(+)
> > >
> > > diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
> > > index d98da0dd260..84f6ef5892e 100755
> > > --- a/source3/script/tests/test_smbclient_s3.sh
> > > +++ b/source3/script/tests/test_smbclient_s3.sh
> > > @@ -1419,6 +1419,10 @@ test_utimes()
> > >  {
> > >      tmpfile=$PREFIX/smbclient_interactive_prompt_commands
> > >  
> > > +    saved_TZ="$TZ"
> > > +    TZ=UTC
> > > +    export TZ
> > > +
> > This has saved_TZ.
> >
> > >      cat > $tmpfile <<EOF
> > >  del utimes_test
> > >  put ${SMBCLIENT} utimes_test
> > > @@ -1433,6 +1437,12 @@ EOF
> > >      out=`eval $cmd`
> > >      ret=$?
> > >  
> > > +    if [ -n "$SAVED_TZ" ] ; then
> > > + export TZ="$SAVED_TZ"
> > > +    else
> > > + unset TZ
> > > +    fi
> > > +
> > And here you deal with SAVED_TZ (notice all caps).
> >
> > So TZ is not preserved.
>
> Aaaaarggggh ! Thanks Alexander (I am a moron :-).
No, you aren't, it is very easy to switch a context and get into an
all-caps mood, especially when almost all well-known environmental
variables are all-caps already. ;)


> Can you review this and make sure I didn't screw
> up again ?
Sure, now it is OK, so please push with anything else in your queue.

> --- a/source3/script/tests/test_smbclient_s3.sh
> +++ b/source3/script/tests/test_smbclient_s3.sh
> @@ -1437,8 +1437,8 @@ EOF
>      out=`eval $cmd`
>      ret=$?
>  
> -    if [ -n "$SAVED_TZ" ] ; then
> - export TZ="$SAVED_TZ"
> +    if [ -n "$saved_TZ" ] ; then
> + export TZ="$saved_TZ"
>      else
>   unset TZ
>      fi
> --
> 2.15.0.531.g2ccb3012c9-goog
>


--
/ Alexander Bokovoy