diff mbox series

Problem when using deprecated flag -> compression = "true"

Message ID AM0PR10MB19068FD71CDAC099C46F74C5FFE60@AM0PR10MB1906.EURPRD10.PROD.OUTLOOK.COM
State Not Applicable
Headers show
Series Problem when using deprecated flag -> compression = "true" | expand

Commit Message

Adducchio Maximilian Nov. 13, 2020, 2:53 p.m. UTC
Hello,

I recently moved to a newer version of SWUpdate and had problems when using the old sw-description.
According to documentation this flag is deprecated and should not used anymore. But it is also written down that "true is equal to compression = zlib).

In my case I've got following error when trying to update:

Now getting status
Status: 1 message: Software Update started !
Status: 2 message: [extract_file_to_tmp] : Found file:  filename sw-description  size 1139
Status: 2 message: [get_common_fields] : Version 0.0.0
Status: 2 message: [get_common_fields] : Description 3705685
Status: 2 message: [parse_hw_compatibility] : Accepted Hw Revision : 1.0
Status: 4 message: ERROR parser/parser.c : parse_common_attributes : 300 : compressed argument: 'true' unknown
Status: 4 message: ERROR parser/parser.c : parser : 726 : Found nothing to install
Status: 4 message: ERROR parser/parser.c : parse_json : 806 : JSON File corrupted
Status: 4 message: ERROR core/parser.c : parse : 258 : no parser available to parse sw-description!
Status: 4 message: ERROR core/stream_interface.c : extract_files : 157 : Compatible SW not found
Status: 4 message: Image invalid or corrupted. Not installing ...
Status: 2 message: [network_initializer] : Main thread sleep again !
Status: 0 message: Waiting for requests...
Swupdate *failed* !


A small change within parser.c has solved the problem and would lead to backward compability:



Best regards
Maximlian Adducchio

Comments

Stefano Babic Nov. 13, 2020, 4:43 p.m. UTC | #1
Hi Maximilian,

On 13.11.20 15:53, Adducchio Maximilian wrote:
> Hello,
> 
>  
> 
> I recently moved to a newer version of SWUpdate and had problems when
> using the old sw-description.
> 
> According to documentation this flag is deprecated and should not used
> anymore. But it is also written down that „true is equal to compression
> = zlib).

Confirmed that "compressed = true"  is still working with current TOT.

> 
>  
> 
> In my case I’ve got following error when trying to update:
> 
>  
> 
> /Now getting status/
> 
> /Status: 1 message: Software Update started !/
> 
> /Status: 2 message: [extract_file_to_tmp] : Found file:  filename
> sw-description  size 1139/
> 
> /Status: 2 message: [get_common_fields] : Version 0.0.0/
> 
> /Status: 2 message: [get_common_fields] : Description 3705685/
> 
> /Status: 2 message: [parse_hw_compatibility] : Accepted Hw Revision : 1.0/
> 
> /Status: 4 message: ERROR parser/parser.c : parse_common_attributes :
> 300 : compressed argument: 'true' unknown/

I can just imagine that you have in your sw-descrption

	compressed = "true";

instead of

	compressed = true;

as it should be.

> 
> /Status: 4 message: ERROR parser/parser.c : parser : 726 : Found nothing
> to install/
> 
> /Status: 4 message: ERROR parser/parser.c : parse_json : 806 : JSON File
> corrupted/
> 
> /Status: 4 message: ERROR core/parser.c : parse : 258 : no parser
> available to parse sw-description!/
> 
> /Status: 4 message: ERROR core/stream_interface.c : extract_files : 157
> : Compatible SW not found/
> 
> /Status: 4 message: Image invalid or corrupted. Not installing .../
> 
> /Status: 2 message: [network_initializer] : Main thread sleep again !/
> 
> /Status: 0 message: Waiting for requests.../
> 
> /Swupdate *failed* !/
> 
> / /
> 
> / /
> 
> A small change within parser.c has solved the problem and would lead to
> backward compability:  
> 
>  
> 
> /diff --git a/parser/parser.c b/parser/parser.c/
> 
> /index 31efe46..62d9e91 100644/
> 
> /--- a/parser/parser.c/
> 
> /+++ b/parser/parser.c/
> 
> /@@ -296,6 +296,8 @@ static int parse_common_attributes(parsertype p,
> void *elem, struct img_type *im/
> 
> /                        image->compressed = COMPRESSED_ZLIB;/
> 
> /                } else if (!strcmp(compressed, "zstd")) {/
> 
> /                        image->compressed = COMPRESSED_ZSTD;/
> 
> /+               } else if (!strcmp(compressed, "true")) {/


If you want to use the old format, it is a boolean and not a string.


Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/parser/parser.c b/parser/parser.c
index 31efe46..62d9e91 100644
--- a/parser/parser.c
+++ b/parser/parser.c
@@ -296,6 +296,8 @@  static int parse_common_attributes(parsertype p, void *elem, struct img_type *im
                        image->compressed = COMPRESSED_ZLIB;
                } else if (!strcmp(compressed, "zstd")) {
                        image->compressed = COMPRESSED_ZSTD;
+               } else if (!strcmp(compressed, "true")) {
+                       image->compressed = COMPRESSED_TRUE;
                } else {
                        ERROR("compressed argument: '%s' unknown", compressed);
                        return -1;