# Buggy code
def verify(self):
    validation_error = super(PrefixReplaceLinkAction, self).verify()
    if validation_error:
        return validation_error

    if islink(self.source_full_path):
        log.trace(
            "ignoring prefix update for symlink with source path %s",
            self.source_full_path,
        )
        # return
        assert False, "I don't think this is the right place to ignore this"

    self.intermediate_path = join(
        self.transaction_context["temp_dir"], text_type(uuid4())
    )

    log.trace("copying %s => %s", self.source_full_path, self.intermediate_path)
    create_link(self.source_full_path, self.intermediate_path, LinkType.copy)

    try:
        log.trace("rewriting prefixes in %s", self.target_full_path)
        update_prefix(
            self.intermediate_path,
            context.target_prefix_override or self.target_prefix,
            self.prefix_placeholder,
            self.file_mode,
        )
    except _PaddingError:
        raise PaddingError(
            self.target_full_path, self.prefix_placeholder, len(self.prefix_placeholder)
        )

    sha256_in_prefix = compute_sha256sum(self.intermediate_path)

    self.prefix_path_data = PathDataV1.from_objects(
        self.prefix_path_data,
        file_mode=self.file_mode,
        path_type=PathType.hardlink,
        prefix_placeholder=self.prefix_placeholder,
        sha256_in_prefix=sha256_in_prefix,
    )

    self._verified = True


# Traceback (PermissionError)
Traceback (most recent call last):
File "/miniconda/lib/python3.6/site-packages/conda/exceptions.py", line 772, in __call__
return func(*args, **kwargs)
File "/miniconda/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main
exit_code = do_call(args, p)
File "/miniconda/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 77, in do_call
exit_code = getattr(module, func_name)(args, parser)
File "/miniconda/lib/python3.6/site-packages/conda/cli/main_create.py", line 11, in execute
install(args, parser, 'create')
File "/miniconda/lib/python3.6/site-packages/conda/cli/install.py", line 255, in install
handle_txn(progressive_fetch_extract, unlink_link_transaction, prefix, args, newenv)
File "/miniconda/lib/python3.6/site-packages/conda/cli/install.py", line 285, in handle_txn
unlink_link_transaction.execute()
File "/miniconda/lib/python3.6/site-packages/conda/core/link.py", line 220, in execute
self.verify()
File "/miniconda/lib/python3.6/site-packages/conda/common/io.py", line 441, in decorated
return f(*args, **kwds)
File "/miniconda/lib/python3.6/site-packages/conda/core/link.py", line 207, in verify
exceptions = self._verify(self.prefix_setups, self.prefix_action_groups)
File "/miniconda/lib/python3.6/site-packages/conda/core/link.py", line 460, in _verify
cls._verify_transaction_level(prefix_setups),
File "/miniconda/lib/python3.6/site-packages/conda/core/link.py", line 455, in <genexpr>
exceptions = tuple(exc for exc in concatv(
File "/miniconda/lib/python3.6/site-packages/conda/core/link.py", line 323, in _verify_individual_level
error_result = axn.verify()
File "/miniconda/lib/python3.6/site-packages/conda/core/path_actions.py", line 410, in verify
self.file_mode)
File "/miniconda/lib/python3.6/site-packages/conda/core/portability.py", line 57, in update_prefix
update_file_in_place_as_binary(realpath(path), _update_prefix)
File "/miniconda/lib/python3.6/site-packages/conda/gateways/disk/update.py", line 33, in update_file_in_place_as_binary
fh = exp_backoff_fn(open, file_full_path, 'rb+')
File "/miniconda/lib/python3.6/site-packages/conda/gateways/disk/__init__.py", line 23, in exp_backoff_fn
return fn(*args, **kwargs)
PermissionError: [Errno 13] Permission denied: '/tmp/tmpp4kwvm4j/be616029-6651-4227-a448-4e595cd8e473'

# Fixed code
def verify(self):
    validation_error = super(PrefixReplaceLinkAction, self).verify()
    if validation_error:
        return validation_error

    if islink(self.source_full_path):
        log.trace(
            "ignoring prefix update for symlink with source path %s",
            self.source_full_path,
        )
        # return
        assert False, "I don't think this is the right place to ignore this"

    self.intermediate_path = join(
        self.transaction_context["temp_dir"], text_type(uuid4())
    )

    log.trace("copying %s => %s", self.source_full_path, self.intermediate_path)
    create_link(self.source_full_path, self.intermediate_path, LinkType.copy)
    make_writable(self.intermediate_path)

    try:
        log.trace("rewriting prefixes in %s", self.target_full_path)
        update_prefix(
            self.intermediate_path,
            context.target_prefix_override or self.target_prefix,
            self.prefix_placeholder,
            self.file_mode,
        )
    except _PaddingError:
        raise PaddingError(
            self.target_full_path, self.prefix_placeholder, len(self.prefix_placeholder)
        )

    sha256_in_prefix = compute_sha256sum(self.intermediate_path)

    self.prefix_path_data = PathDataV1.from_objects(
        self.prefix_path_data,
        file_mode=self.file_mode,
        path_type=PathType.hardlink,
        prefix_placeholder=self.prefix_placeholder,
        sha256_in_prefix=sha256_in_prefix,
    )

    self._verified = True