[Debian-med-packaging] Bug#986041: Bug#986041: imagej script bug in a system with no swap

Étienne Mollier etienne.mollier at mailoo.org
Sun Mar 28 18:43:02 BST 2021


Control: tag -1 patch

Greetings Alexis,

Alexis PM, on 2021-03-28 13:50:02 +0000:
> max_mem=`free | awk 'NR == 2 {fmem=int($2 / 1024); if (fmem < 4000) {print fmem} else {print 4000}}'`
> free_mem=`free | awk 'NR == 3 {fmem=int($4 / 1024); if (fmem < 4000) {print fmem} else {print 4000}}'`

It seems to me that code parses the former "free" command
format, which looked like the following, to get the available
free memory, disregarding file system cache usage, on line
"-/+ buffers/cache:" and column "free", at the time of the
introduction of the script:

	             total       used       free     shared    buffers     cached
	Mem:       1000192     465656     534536        176      55096     175196
	-/+ buffers/cache:     235364     764828
	Swap:      1044476      12372    1032104

While today's "free" output format looks like the following:

	               total        used        free      shared  buff/cache   available
	Mem:        65876148     8038800    10920828       55264    46916520    57046504
	Swap:        1048572        4608     1043964

The equivalent value is now located line "Mem:", column
"available", so in terms of awk, that would translate to the
following:

	free_mem=`free | awk 'NR == 2 {fmem=int($7 / 1024); if (fmem < 4000) {print fmem} else {print 4000}}'`

and:

	free_mem=`free | awk 'NR == 2 {fmem=int($7 / 1024); if (fmem < 1800) {print fmem} else {print 1800}}'`

on the 32 bit branch of the conditional; hence tagging the bug
with patch available.

Many thanks for noticing and reporting the problem!

Have a nice day,  :)
-- 
Étienne Mollier <etienne.mollier at mailoo.org>
Fingerprint:  8f91 b227 c7d6 f2b1 948c  8236 793c f67e 8f0d 11da
Sent from /dev/pts/5, please excuse my verbosity.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/debian-med-packaging/attachments/20210328/cc08f03d/attachment.sig>


More information about the Debian-med-packaging mailing list