This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1473934 - Can't include <sys/quota.h> before <iostream>
Can't include <sys/quota.h> before <iostream>
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Kernel Maintainer List
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2017-07-22 10:48 EDT by Jyrki Havia
Modified: 2017-09-18 08:42 EDT (History)
34 users (show)

See Also:
Fixed In Version: kernel-4.14.0-0.rc0.git3.1.fc28
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2017-09-18 08:42:09 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Log of two compilation runs with the example code. First OK, second fails. (2.82 KB, text/plain)
2017-07-22 10:48 EDT, Jyrki Havia
no flags Details

  None (edit)
Description Jyrki Havia 2017-07-22 10:48:04 EDT
Created attachment 1302790 [details]
Log of two compilation runs with the example code. First OK, second fails.

Description of problem:
On just installed (2 hours ago) Fedora 26
include file <sys/quota.h> pollutes g++ environment
so that including <iostream> after <sys/quota.h> produces error.

Version-Release number of selected component (if applicable):
gcc version 7.1.1 20170622 (Red Hat 7.1.1-3) (GCC) 

How reproducible:
Compile following snippet by
[havia@game mailquota]$ g++ err.cpp   -c -DERROR_ON=0
  All fine

[havia@game mailquota]$ g++ err.cpp   -c -DERROR_ON=1
  Won't compile

--- clip ---
#if ERROR_ON == 1
#include <sys/quota.h>
#include <iostream>
#include <iostream>
#include <sys/quota.h>

int func(void) { return 0; }
--- clip ---

Steps to Reproduce:
1. See test code above.

Actual results:
Compilation error

Expected results:
Compilation without errors.

Additional info:
Comment 1 Jonathan Wakely 2017-07-23 15:57:57 EDT
This isn't a GCC bug. This also fails:

#include <sys/quota.h>
#include <errno.h>
#ifndef ERANGE
#error no ERANGE

This is because <sys/quota.h> includes <linux/errno.h> so when <bits/errno.h> includes it again (after doing #undef ERANGE) it doesn't define anything.
Comment 2 Jakub Jelinek 2017-07-23 18:09:35 EDT
That means it is a glibc bug caused by
commit 4d728087ef8cc826b05bd21d0c74d4eca9b1a27d
Author: Florian Weimer <>
Date:   Thu Sep 1 15:53:13 2016 +0200

    Base <sys/quota.h> on Linux kernel headers [BZ #20525]
    Macros which are also defined in <linux/quota.h> are removed, and
    <linux/quota.h> is included instead.
    This commit cleans up the definition of fs_to_dq_blocks and struct
    dqblock and struct dqinfo, too.

Either sys/quota.h should ensure linux/errno.h is not included, or should include <errno.h> first or something different that will work.
Comment 3 Florian Weimer 2017-08-11 10:32:17 EDT
I posted a kernel patch:
Comment 4 Florian Weimer 2017-09-18 08:42:09 EDT
Fixed in the kernel with this upstream commit:

commit 34fc75bfc616f1c1fbab56508c3f48f4b97c97ea
Author: Florian Weimer <>
Date:   Fri Aug 11 16:24:15 2017 +0200

    uapi/linux/quota.h: Do not include linux/errno.h
    linux/errno.h is very sensitive to coordination with libc headers.
    Nothing in linux/quota.h needs it, so this change allows using
    this header in more contexts.

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