Skip to content

[Bug] Python 3 compatibility: ConfigParser AttributeError and datetime.utcnow() DeprecationWarning (v2.6.1) #1111

@AKRiLLiCK

Description

@AKRiLLiCK

Description

When utilizing the pam_python3.so wrapper on modern rolling-release distributions (e.g., Arch/EndeavourOS with Python 3.12+), Howdy 2.6.1 fails to execute the PAM hook due to a Python 2 syntax artifact. Furthermore, a deprecation warning in the comparison logic leaks into stderr during successful authentication.

Environment

  • OS: Arch Linux / EndeavourOS
  • Kernel: 7.0.2-cachyos
  • Python: 3.14
  • Howdy Version: 2.6.1

Errors

1. PAM Wrapper Crash (/lib/security/howdy/pam.py)
Because Python 3 renamed the module to lowercase, instantiating configparser.configparser() throws:
AttributeError: module 'configparser' has no attribute 'configparser'. Did you mean: 'ConfigParser'?
This causes the module to return PAM_IGNORE, breaking the biometric auth chain.

2. Deprecation Warning (/lib/security/howdy/compare.py)
DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).

Proposed Fix

In howdy/src/pam.py (Line 13):
Change the class instantiation to maintain standard Python 3 capitalization:

# Old
config = configparser.configparser()
# New
config = configparser.ConfigParser()

In howdy/src/compare.py (Line 57):
Update the datetime call to the modern, timezone-aware standard:

# Old
"Date: " + datetime.datetime.utcnow().strftime("%Y/%m/%d %H:%M:%S UTC"),
# New
"Date: " + datetime.datetime.now(datetime.UTC).strftime("%Y/%m/%d %H:%M:%S UTC"),

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions