Package: dphys-swapfile
Version: 20100506-5
Severity: important
Tags: patch

Dear Maintainer,

please update the part of detecting fallocate as the exit code of the type 
command causes the script to stop if fallocate is not found. 
Please also avoid using fallocate in case of f2fs by checking the filesystem 
type.
Both corrections are implemented already, see the patch. 

-- System Information:
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 10 (buster)
Release:        10
Codename:       buster
Architecture: armv7l

Kernel: Linux 4.19.75-v7l+ (SMP w/4 CPU cores)
Kernel taint flags: TAINT_CRAP
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages dphys-swapfile depends on:
ii  dc        1.07.1-2
ii  lsb-base  10.2019051400+rpi1

dphys-swapfile recommends no packages.

dphys-swapfile suggests no packages.

-- Configuration Files:
/etc/dphys-swapfile changed:
CONF_SWAPSIZE=100


-- no debconf information
--- dphys-swapfile      2018-08-23 23:29:41.000000000 +0200
+++ dphys-swapfile.new  2019-10-22 07:34:32.656273926 +0200
@@ -1,4 +1,4 @@
-#! /bin/sh
+#/w! /bin/sh
 # /sbin/dphys-swapfile - automatically set up an swapfile
 # author Neil Franklin, last modification 2010.05.05
 # This script is copyright ETH Zuerich Physics Departement,
@@ -145,8 +145,9 @@
       mv /etc/.fstab /etc/fstab
 
       # use fallocate if found to create swapfile, else use dd
-      type fallocate > /dev/null
-      if [ $? -eq 0 ]; then
+      # avoid fallocate on f2fs file system
+      fs_type=$( stat -c %T -f $(dirname "${CONF_SWAPFILE}") )
+      if [ hash fallocate 2>/dev/null && "${fs_type}" != "f2fs"  ] ; then
         fallocate -l "${CONF_SWAPSIZE}"M "${CONF_SWAPFILE}" 2> /dev/null
       else
         dd if=/dev/zero of="${CONF_SWAPFILE}" bs=1048576 \

Reply via email to