yast / yast-yast2

YaST module yast2
http://en.opensuse.org/Portal:YaST
GNU General Public License v2.0
54 stars 44 forks source link

do not strip trailing white space in XML elements (bsc#1195910) #1243

Closed wfeldt closed 2 years ago

wfeldt commented 2 years ago

Task

Surrounding white space in some elements may be desired. Like in scripts or other file content. Be more careful when removing it.

The catch

The AutoYaST profile is processed by YaST to construct the final profile. It's written, modified by scripts, then read again, for example. Ensure that during this processing the CDATA 'attribute' to elements is not lost.

Solution

Strip leading white space when reading XML CDATA blocks. And create CDATA blocks when generating XML if an element contains trailing white space.

Note

Why not also keeping leading white space? - It's common to have a leading newline in script sections. They must be removed. See https://doc.opensuse.org/projects/autoyast/#id-1.9.4.2.4.5 for an example.

Note 2

On closer inspection, in SLE12 leading white space is preserved. And it causes no issues. Hm.

coveralls commented 2 years ago

Coverage Status

Coverage decreased (-0.02%) to 40.555% when pulling 59b960c0d1f9b472462cdb20b26ecedbae781507 on sw_10 into c762c93ffee7338dc515f2cedd1996d28e2a1fd8 on SLE-15-SP3.

shundhammer commented 2 years ago

If it works, I am all for it.

yast-bot commented 2 years ago

:heavy_check_mark: Internal Jenkins job #5 successfully finished :heavy_check_mark: Created IBS submit request #265337