cake-build / cake-build/cake

DirectoryAliases.MakeAbsolute computes the wrong path if the path contains ..

Open
#4,413 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.2k
Forks
778
Avg merge
3h 37m
Merged PRs (30d)
21

Description

### Prerequisites

- [X] I have written a descriptive issue title
- [X] I have searched [issues](https://github.com/cake-build/cake/issues) to ensure it has not already been reported

### Cake runner

Cake Frosting

### Cake version

5.0.0

### Operating system

Windows

### Operating system architecture

x64

### CI Server

_No response_

### What are you seeing?

```csharp
var b = context.MakeAbsolute(context.Directory(".")); // C:/repos/repo/build
var d = context.MakeAbsolute(b.Combine(new DirectoryPath("../Dashboards"))); // C:/repos/repo/build/../Dashboards
```

### What is expected?

```csharp
var b = context.MakeAbsolute(context.Directory(".")); // C:/repos/repo/build
var d = context.MakeAbsolute(b.Combine(new DirectoryPath("../Dashboards"))); // C:/repos/repo/build/Dashboards
```

### Steps to Reproduce

```csharp
var b = context.MakeAbsolute(context.Directory("."));
var d = context.MakeAbsolute(b.Combine(new DirectoryPath("../Dashboards")));
```

### Output log

_No response_

Contributor guide

Open the contributing guide

Research direction

Start at DirectoryAliases.MakeAbsolute and reproduce the issue with the Cake Frosting snippet on Windows using Cake 5.0.0. Trace how the combined DirectoryPath containing ../Dashboards is resolved, then verify the resulting path against the expected output shown in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.