Bug#1055150: a2d: apt remove a2k nukes user data (postinst)

2023-11-03 Thread Yogeswaran Umasankar

Hi,
I have revised postrm not to remove user config files. I let the dpkg to
take care of config files.

Thank you,
Yogeswaran Umasankar



Bug#1055150: a2d: apt remove a2k nukes user data (postinst)

2023-11-01 Thread Yogeswaran Umasankar

Hi,
On Wed, Nov 01, 2023 at 10:38:31AM +0100, Tobias Frost wrote:

Package: a2d
Version: 2.0.1-1
Severity: serious
Justification: Policy 10.7.3

Found during package review:

postinst has:

#Remove user conf files
case "$1" in
   purge|remove|deconfigure|disappear)
   # Remove the user-generated configuration file
   if [ -e "/etc/a2d" ]; then
 rm -r /etc/a2d
   fi

   if [ -e "/var/lib/a2d" ]; then
 rm -r /var/lib/a2d
   fi

   if [ -e "/var/log/a2d_gu_error.log" ]; then
 rm -r /var/log/a2d_gu_error.log
   fi

   ;;

   *)
   # For other cases, do nothing
   ;;
esac

Multiple issues.
- Deleting user data is postinst must only done when purging.
- /etc/a2d is handled as conffile, it it dpkg's job to clean it up.
- /var/lib/a2d and /var/lib/a2d/dbs is also shipped with the package,
 and removing the directories should also be left to dpkg.
 (If possible the package should only delete the files it has
 created itself.)


Thank you for reviewing the package. I believe you are talking about
postrm, postinst dont remove anything. 


As you suggested, I have fixed the postrm so only during purge it
deletes user config and user's a2d database. The user generated/modified
config and user's a2d database created by flask seems to stay after
removing the package, so removing them by postrm during purge helps.

Thank you,
Yogeswaran Umasankar.



Bug#1055150: a2d: apt remove a2k nukes user data (postinst)

2023-11-01 Thread Tobias Frost
Package: a2d
Version: 2.0.1-1
Severity: serious
Justification: Policy 10.7.3

Found during package review:

postinst has:

#Remove user conf files
case "$1" in
purge|remove|deconfigure|disappear)
# Remove the user-generated configuration file
if [ -e "/etc/a2d" ]; then
  rm -r /etc/a2d
fi

if [ -e "/var/lib/a2d" ]; then
  rm -r /var/lib/a2d
fi

if [ -e "/var/log/a2d_gu_error.log" ]; then
  rm -r /var/log/a2d_gu_error.log
fi

;;

*)
# For other cases, do nothing
;;
esac

Multiple issues.
- Deleting user data is postinst must only done when purging.
- /etc/a2d is handled as conffile, it it dpkg's job to clean it up.
- /var/lib/a2d and /var/lib/a2d/dbs is also shipped with the package,
  and removing the directories should also be left to dpkg.
  (If possible the package should only delete the files it has
  created itself.)