View Issue Details

IDProjectCategoryView StatusLast Update
0001901Slicer4Core: Building (CMake, Superbuild)public2012-05-08 15:08
Reporterschuhschuh Assigned Tojcfr  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version 
Target VersionSlicer 4.1.1Fixed in VersionSlicer 4.2.0 
Summary0001901: slicer_setting_variable_message causes problems with EXTENSION_LICENSE_SHORT_DESCRIPTION
Description

This applies to the trunk revision 19,893.

Because EXTENSION_LICENSE_SHORT_DESCRIPTION exceeds the length of 40, which is hard coded in slicer_setting_variable_message() in UseSlicer.cmake.in, the following error pops up

CMake Error at /Users/andreas/Development/Builds/Slicer4/Slicer-build/UseSlicer.cmake:126 (string):
string sub-command RANDOM invoked with bad length.

To make this function more robust, I suggest to change the code as follows:

[...]
if (pad_length GREATER 0)
string(RANDOM LENGTH ${pad_length} ALPHABET ${fill_char} pretext_dots)
set(text "${pretext} ${pretext_dots}: ${${varname}}")
else ()
set(text "${pretext}: ${${varname}}")
endif ()
[...]

TagsNo tags attached.

Activities

jcfr

jcfr

2012-04-13 17:56

administrator   ~0004016

Last edited: 2012-04-13 17:57

Thanks for reporting the isssue.

In fact, the problem seems to be caused by the fact "pad_length" is smaller than 5.

Indeed:
len(EXTENSION_LICENSE_SHORT_DESCRIPTION) -> 36
pad_length = 40 - 36 -> 4

According to CMake doc, since the default length for random string is 5, giving a value of 4 is probably causing trouble.

All of that said, using RANDOM is just hack ... I will fix the problem later this weekend.

schuhschuh

schuhschuh

2012-04-13 18:41

reporter   ~0004017

Last edited: 2012-04-13 18:41

Not quite, I admit I haven't looked at the docu of string(RANDOM), but the problem here is that

len("Setting EXTENSION_LICENSE_SHORT_DESCRIPTION") > 40

I simply assumed that the negative pad_length caused the issue. At least changing the function as posted in the initial report fixed it.

jcfr

jcfr

2012-04-14 15:21

administrator   ~0004018

Fixed in r19894 - See https://github.com/Slicer/Slicer/commit/0fe4bfe37955c5a89ad5c99f742322766d298e15

If it works as expected, please make sure to close the issue.

schuhschuh

schuhschuh

2012-04-14 19:19

reporter   ~0004019

Additionally I would change the constant pretext_right_jusitfy_length to >= 43 so the output looks nicely aligned again...

2012-04-14 19:19

 

2012-04-14 19:46

 

schuhschuh

schuhschuh

2012-04-14 19:49

reporter   ~0004020

I just played a bit with that function and made some more small changes which deal with the different cases:

Setting ABC ...:
Setting ABCDEF :
Setting ABCDEFG:
Setting ABCDEFGH:

... better noticeable with a monospaced font.

jcfr

jcfr

2012-04-16 15:12

administrator   ~0004024

Fixed in r19900 - See https://github.com/Slicer/Slicer/commit/52efdecdc9b4db4d9bdc27d63e27456cfef77aa8

If it works as expected, please make sure to close the issue.

Issue History

Date Modified Username Field Change
2012-04-13 15:14 schuhschuh New Issue
2012-04-13 15:14 schuhschuh Status new => assigned
2012-04-13 15:14 schuhschuh Assigned To => jcfr
2012-04-13 17:56 jcfr Note Added: 0004016
2012-04-13 17:57 jcfr Note Edited: 0004016
2012-04-13 18:41 schuhschuh Note Added: 0004017
2012-04-13 18:41 schuhschuh Note Edited: 0004017
2012-04-14 15:21 jcfr Note Added: 0004018
2012-04-14 15:21 jcfr Status assigned => resolved
2012-04-14 15:21 jcfr Fixed in Version => Slicer 4.x AHM Summer 2012
2012-04-14 15:21 jcfr Resolution open => fixed
2012-04-14 19:19 schuhschuh Note Added: 0004019
2012-04-14 19:19 schuhschuh Status resolved => feedback
2012-04-14 19:19 schuhschuh Resolution fixed => reopened
2012-04-14 19:19 schuhschuh File Added: UseSlicerMacrosIncrease_pretext_right_jusitfy_length.patch
2012-04-14 19:46 schuhschuh File Added: UseSlicerMacros_slicer_setting_variable_message.patch
2012-04-14 19:49 schuhschuh Note Added: 0004020
2012-04-16 15:12 jcfr Note Added: 0004024
2012-04-16 15:12 jcfr Status feedback => resolved
2012-04-16 15:12 jcfr Resolution reopened => fixed
2012-04-16 16:04 schuhschuh Status resolved => closed
2012-05-08 15:08 jcfr Target Version => Slicer 4.1.1