Bug 3564 - smbget have reversed exit status codes.
smbget have reversed exit status codes.
Status: RESOLVED WORKSFORME
Product: Samba 3.0
Classification: Unclassified
Component: Client Tools
3.0.21c
Other Other
: P3 normal
: none
Assigned To: Amit Regmi
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-02-28 13:05 UTC by Max N. Boyarov
Modified: 2014-10-29 15:39 UTC (History)
0 users

See Also:


Attachments
With this patch smbget would return 0 on every INCOMPLETE download and would return 1 on a SUCCESSFUL download (1.49 KB, patch)
2006-04-27 07:44 UTC, Amit Regmi
no flags Details
With this patch smbget would return 0 on every INCOMPLETE download and would return 1 on a SUCCESSFUL download (3.51 KB, patch)
2006-04-27 07:55 UTC, Amit Regmi
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Max N. Boyarov 2006-02-28 13:05:04 UTC
All error exit with 0 , for sample in smb_download_file, all success states is return 1, but main and readrcfile and clean_exit return 0 as success.

for sample:

$ smbget -N smb://unk/none && echo "downloaded ok." || echo "Fail to download."
Downloaded 0b in 0 seconds
downloaded ok.
Comment 1 Amit Regmi 2006-04-27 07:44:00 UTC
Created attachment 1880 [details]
With this patch smbget would return 0 on every INCOMPLETE download and would return 1 on a SUCCESSFUL download 

The following test cases would certainly clarify the output the Reporter must have got which made him file the bug 
 
=================================================================================

$ ./main.exe false && echo "   success" || echo "   failure"
 false   success             ( when the program returns 0 )

$ ./main.exe true && echo "   success" || echo "   failure"
 true   failure        ( when the program returns 1 )

$ cat main.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc , char *argv[])
{
        if (strcmp(argv[1] , "true") == 0 )  {
                printf("\n true");
                return 1;
        }
        else{
                printf("\n false");
                return 0;
        }
}

$ true && echo "   success" || echo "   failure"
   success

$ false && echo "   success" || echo "   failure"
   failure
Comment 2 Amit Regmi 2006-04-27 07:55:48 UTC
Created attachment 1881 [details]
With this patch smbget would return 0 on every INCOMPLETE download and would return 1 on a SUCCESSFUL download 

The following test cases would certainly clarify the output the Max must have got which made him file the bug 
 
=================================================================================

$ ./main.exe false && echo "   success" || echo "   failure"
 false   success             ( when the program returns 0 )

$ ./main.exe true && echo "   success" || echo "   failure"
 true   failure        ( when the program returns 1 )

$ cat main.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc , char *argv[])
{
        if (strcmp(argv[1] , "true") == 0 )  {
                printf("\n true");
                return 1;
        }
        else{
                printf("\n false");
                return 0;
        }
}

$ true && echo "   success" || echo "   failure"
   success

$ false && echo "   success" || echo "   failure"
   failure
Comment 3 Björn Jacke 2014-10-29 15:39:13 UTC
smbget extis always with 1 on errors and exits with 0 on success. Looks completely fine here with a 4.1 smbget