Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"apache-airflow-providers-samba" not working with Windows shares due to fixed use of forward slahes #47206

Open
1 of 2 tasks
florianWeCG opened this issue Feb 28, 2025 · 4 comments · May be fixed by #47299
Open
1 of 2 tasks

Comments

@florianWeCG
Copy link

florianWeCG commented Feb 28, 2025

Apache Airflow version

2.10.5

If "Other Airflow 2 version" selected, which one?

No response

What happened?

When I connect to a Windows share using the samba provider I am receiving a STATUS_INVALID_PARAMETER error when I try to use the "listdir" function.

This is due to the fact that in https://github.com/apache/airflow/blob/main/providers/samba/src/airflow/providers/samba/hooks/samba.py line 88 the path is created using // at the beginning and / as a separator.
When using the smbclient python package directly and typing backward slashes for joining a path, it works without any errors.

What you think should happen instead?

There should be a way to configure the samba provider to use backward slashes instead of forward slashes for joining the path.

How to reproduce

You will need a Windows computer with a network share which can be accessed using a username and password.
E.g. computer name "windowsSharer", share "windowsShare", user "WindowsUser", ...
The connection can then be configured in airflow.
Create a simple dag where the SambaHook is created and the listdir function is called, e.g.:
hook = SambaHook(samba_conn_id=samba_conn_id) files_and_dirs = hook.listdir("windowsDirectory") print(f"{files_and_dirs}")

The listdir function will fail.
However, using smbclient directly like this:
from smbclient import listdir, mkdir, register_session, rmdir, scandir
from smbclient.path import isdir
pathBackSlash = r"\\windowsSharer\windowsShare\windowsDirectory"
for filename in listdir(pathBackSlash, username=r"WindowsUser@Domain", password="secret"):
print(f"{filename}")
Will work, and when you change to forward slashes you get the same "STATUS_INVALID_PARAMETER" message like with the airflow provider.

Operating System

Ubuntu 24.04.2 LTS (in wsl)

Versions of Apache Airflow Providers

apache-airflow-providers-samba==4.9.1

Deployment

Virtualenv installation

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@florianWeCG florianWeCG added area:core kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet labels Feb 28, 2025
Copy link

boring-cyborg bot commented Feb 28, 2025

Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.

@potiuk potiuk added good first issue and removed needs-triage label for new issues that we didn't triage yet labels Feb 28, 2025
@AasthathecoderX
Copy link

AasthathecoderX commented Mar 1, 2025

Hi @potiuk,

I am interested in contributing to this project as part of Google Summer of Code 2025. Since this is my first time participating in GSoC, I would appreciate some guidance on how to proceed.

Would it be appropriate for me to raise a PR for this issue? If so, are there any specific guidelines or prerequisites I should follow before submitting my contribution?

Looking forward to your insights.

Thank you,
Aastha Bhat

@potiuk
Copy link
Member

potiuk commented Mar 1, 2025

We do not have GSoC programme. But you can cantribute as you wish - just follow https://github.com/apache/airflow/blob/main/contributing-docs/README.rst like everyone else - all the information on requirements, how to communicate, how to submit PRs etc. are there.

@AasthathecoderX
Copy link

AasthathecoderX commented Mar 1, 2025

Ok @potiuk Sir, thank you for the clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants