Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 063b583d authored by Ido Ben-Hur's avatar Ido Ben-Hur Committed by basamaryan
Browse files

Revert "Check filepath inside block map file as well"

it makes no sense to check this path is canonical.
this path would for example show:
"/dev/block/bootdevice/by-name/userdata" - depending on uncrypt zip location.
canonical will than always return the real block file, for example: /dev/block/sda31
they will always be different, which will always make CheckPathCanonical return false.

checking for the real uncrypt file's location also doesn't make any sense.
because it "doesn't exist". it's being accessed directly (block access) when flashed.

google forgot about A-only devices.... I have nothing else to say.

This reverts commit 8e34d47e.

Change-Id: I65e5e3fcc61a6ac9b4f07bec328f3796d5e7c361
parent e30a8e84
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -838,19 +838,6 @@ bool SetupPackageMount(const std::string& package_path, bool* should_use_fuse) {
      LOG(ERROR) << "Failed to mount " << block_map_path;
      return false;
    }
    auto block_map_data = BlockMapData::ParseBlockMapFile(block_map_path);
    if (!CheckPathCanonical(block_map_data.path())) {
      LOG(ERROR) << "Block map " << package_path << " contains non-canonical path "
                 << block_map_data.path() << " abort installation.";
      return false;
    }
    if (!BlockDevHasFstab(block_map_data.path())) {
      LOG(ERROR) << "Block device " << block_map_path
                 << " does not have corresponding fstab. This might be an external device, "
                    "aborting installation.";
      return false;
    }

    // uncrypt only produces block map only if the package stays on /data.
    *should_use_fuse = false;
    return true;
+0 −4
Original line number Diff line number Diff line
@@ -32,10 +32,6 @@ Volume* volume_for_mount_point(const std::string& mount_point);
// success (volume is mounted).
int ensure_path_mounted(const std::string& path);

// Return true if the block device has a corresponding entry
// in fstab
bool BlockDevHasFstab(const std::string& path);

// Similar to ensure_path_mounted, but allows one to specify the mount_point.
int ensure_path_mounted_at(const std::string& path, const std::string& mount_point);

+0 −20
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@
#include <string>
#include <vector>

#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <android-base/stringprintf.h>
@@ -167,25 +166,6 @@ int ensure_volume_unmounted(const std::string& blk_device) {
  return 0;
}

bool BlockDevHasFstab(const std::string& path) {
  std::string bdev_path;
  if (!android::base::Realpath(path, &bdev_path)) {
    PLOG(ERROR) << "Failed to get realpath for " << path;
    return false;
  }
  for (const auto& entry : fstab) {
    std::string fstab_bdev_path;
    if (!android::base::Realpath(entry.blk_device, &fstab_bdev_path)) {
      PLOG(ERROR) << "Failed to get realpath for " << entry.blk_device;
      return false;
    }
    if (fstab_bdev_path == bdev_path) {
      return true;
    }
  }
  return false;
}

static int exec_cmd(const std::vector<std::string>& args) {
  CHECK(!args.empty());
  auto argv = StringVectorToNullTerminatedArray(args);