Skip to content

bsdtar incompatibility when decrypting files.gpg #18

Closed
@vendion

Description

OS: PacBSD (FreeBSD based)
yadm version: 1.04


When trying to decrypt the files.gpg on one of my computers running PacBSD, thus using bsdtar, yadm has the following error:

tar: Error opening archive: Failed to open '/dev/sa0'
gpg: encrypted with 2048-bit RSA key, ID B460C43FA28FD091, created 2014-06-19
      "keybase.io/vendion <vendion@keybase.io>"
ERROR: Unable to extract encrypted files.

My understanding is the source of the problem is line 206 where data is passed to tar via STDIN. My understanding is that bsdtar, and all other POSIX-compliant tar implementations require the -f flag when extracting data, they also require the - dash to specify STDIN. With GNU tar the -f - is optional.

Both GNU and BSD tar implementations support the following syntax for taking data from STDIN:

tar -xf -

Thus lines 199-211 should probably read:

  if [ "$DO_LIST" = "YES" ] ; then
    tar_option="t"
  else
    tar_option="xf"
  fi

  #; decrypt the archive
  (gpg -d "$YADM_ARCHIVE" || echo 1) | tar v$tar_option - -C"$YADM_WORK"
  if [ $? = 0 ] ; then
    [ ! "$DO_LIST" = "YES" ] && echo "All files decrypted."
  else
    error_out "Unable to extract encrypted files."
  fi

edit: Linking to relevant Stack overflow answer and removing unrelated error.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions