# Buggy code
def _validate_output_path(cls, path, stage=None):
    from dvc.dvcfile import is_valid_filename

    if is_valid_filename(path):
        raise cls.IsStageFileError(path)

    if stage:
        check = stage.repo.tree.dvcignore.check_ignore(path)
        if check.match:
            raise cls.IsIgnoredError(check)


# Traceback (dvc.output.base.OutputIsIgnoredError)
dvc status -v
2020-11-28 16:41:28,063 DEBUG: Check for update is enabled.
2020-11-28 16:41:28,069 DEBUG: fetched: [(3,)]
2020-11-28 16:41:28,073 DEBUG: fetched: [(1404595,)]
2020-11-28 16:41:28,154 ERROR: Path 'fms_unit.csv' is ignored by
.dvcignore:1:/*
------------------------------------------------------------
Traceback (most recent call last):
File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/command/status.py", line 58, in run
recursive=self.args.recursive,
File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 60, in wrapper
return f(repo, *args, **kwargs)
File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 152, in status
self, targets, with_deps=with_deps, recursive=recursive
File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 36, in _local_status
return _joint_status(pairs)
File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 16, in _joint_status
for stage, filter_info in pairs:
File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/status.py", line 33, in <genexpr>
for t in targets
File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 358, in collect_granular
return [(stage, None) for stage in self.stages]
File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/funcy/objects.py", line 28, in __get__
res = instance.__dict__[self.fget.__name__] = self.fget(instance)
File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 493, in stages
return self._collect_stages()
File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 501, in _collect_stages
new_stages = self.get_stages(os.path.join(root, file_name))
File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/repo/__init__.py", line 290, in get_stages
return list(dvcfile.stages.values())
File "/usr/lib/python3.7/_collections_abc.py", line 762, in __iter__
yield self._mapping[key]
File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/stage/loader.py", line 153, in __getitem__
self.dvcfile, deepcopy(self.stage_data), self.stage_text
File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/stage/loader.py", line 164, in load_stage
stage.outs = output.loadd_from(stage, d.get(Stage.PARAM_OUTS) or [])
File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/__init__.py", line 150, in loadd_from
desc=desc,
File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/__init__.py", line 126, in _get
desc=desc,
File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/local.py", line 24, in __init__
super().__init__(stage, path, *args, **kwargs)
File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/base.py", line 109, in __init__
self._validate_output_path(path, stage)
File "/home/anotherbugmaster/.virtualenvs/PTR/lib/python3.7/site-packages/dvc/output/base.py", line 535, in _validate_output_path
raise cls.IsIgnoredError(check)
dvc.output.base.OutputIsIgnoredError: Path 'fms_unit.csv' is ignored by
.dvcignore:1:/*
------------------------------------------------------------
2020-11-28 16:41:28,214 DEBUG: Analytics is enabled.
2020-11-28 16:41:28,251 DEBUG: Trying to spawn '['daemon', '-q', 'analytics', '/tmp/tmp0m393p29']'
2020-11-28 16:41:28,252 DEBUG: Spawned '['daemon', '-q', 'analytics', '/tmp/tmp0m393p29']'

# Fixed code
def _validate_output_path(cls, path, stage=None):
    from dvc.dvcfile import is_valid_filename

    if is_valid_filename(path):
        raise cls.IsStageFileError(path)

    if stage:
        abs_path = os.path.join(stage.wdir, path)
        if stage.repo.tree.dvcignore.is_ignored(abs_path):
            check = stage.repo.tree.dvcignore.check_ignore(abs_path)
            raise cls.IsIgnoredError(check)