RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1651310 - FcgidInitialEnv truncates environment variable values to 127 bytes
Summary: FcgidInitialEnv truncates environment variable values to 127 bytes
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: mod_fcgid
Version: 8.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: 8.0
Assignee: Luboš Uhliarik
QA Contact: Maryna Nalbandian
Depends On:
Blocks: 1618477 1620531 1961948
TreeView+ depends on / blocked
Reported: 2018-11-19 16:25 UTC by Petr Pisar
Modified: 2021-05-19 06:37 UTC (History)
2 users (show)

Fixed In Version: mod_fcgid-2.3.9-13.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1961948 (view as bug list)
Last Closed: 2019-06-14 00:52:14 UTC
Type: Bug
Target Upstream Version:

Attachments (Terms of Use)

Description Petr Pisar 2018-11-19 16:25:02 UTC
mod_fcgid expunges environment variables for the executed programs. There is FcgidInitialEnv directive to define an environment variable that will be passed to an executed program. However there seems to be a silent truncation of the variable value if it is longer then 127 characters.


(1) httpd configuration:

FcgidInitialEnv XXX "/opt/app-root/src/bin:/opt/app-root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/app-root/src/extlib/bin"
<Location /psgi>
  SetHandler fcgid-script
  Options +ExecCGI
  FcgidWrapper "/usr/local/bin/psgiwrapper" virtual

(2) /usr/local/bin/psgiwrapper script dumps the environment to stderr:

use Data::Dumper;
warn Data::Dumper::Dumper(\%ENV);

(3) Retrieve the "/psgi" document:

$ wget -O /dev/null http://localhost/psgi

(4) Check httpd's error_log:

[Mon Nov 19 17:09:10.382047 2018] [core:notice] [pid 13607:tid 139764774131968] AH00094: Command line: 'httpd -D FOREGROUND'
$VAR1 = { 
          'XXX' => '/opt/app-root/src/bin:/opt/app-root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/app-root/src/extlib/b',
          'PATH' => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin'
[Mon Nov 19 17:09:14.892883 2018] [fcgid:warn] [pid 13612:tid 139764435437312] (104)Connection reset by peer: [client ::1:35680] mod_fcgid: error reading data from FastCGI server
[Mon Nov 19 17:09:14.892952 2018] [core:error] [pid 13612:tid 139764435437312] [client ::1:35680] End of script output before headers: psgi

Here you can see the XXX variable is missing last 2 characters. It's cut exactly at 128 bytes (including trailing zero).

This seems to be is caused by INITENV_VAL_LEN macro defined to 128 in fcgid_conf.h.

Please increase the length (256 bytes is fine for me). I need it for using mod_fcgid in perl s2i container image.

Affected package: mod_fcgid-2.3.9-12.el8.x86_64.

Note You need to log in before you can comment on or make changes to this bug.