Commit Graph

11290 Commits

Author SHA1 Message Date
Corinna Vinschen 5e9b414e1c Add release message for commit eb61113
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-19 17:25:31 +02:00
Corinna Vinschen 3a2f654379 Add release message for commit a871644
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-19 16:54:56 +02:00
Corinna Vinschen a8716448ce Simplify "Windows-standard-like" permissions
Commit 97d0449 left a bit to be desired.  First, the fact that any
new-style ACL couldn't be "standard ACL" anymore was very much over
the top.  On one hand Admins and SYSTEM ACEs are not supposed to be
masked, but on the other hand we *must* create the CLASS_OBJ
because otherwise we don't have information about masking the
execute perms for both groups.  The ACL would also fail aclcheck.

And while get_posix_access now returns the "is standard acl" flag,
it hasn't been utilized by set_created_file_access.  Rather,
set_created_file_access has simply continued to check for
nentries > MIN_ACL_ENTRIES, which led to all kinds of weird group
and CLASS_OBJ perms.  The new code now always manipulates CLASS_OBJ
perms if a CLASS_OBJ is present, and it always manipulates group perms
if the ACL has been marked as "standard" ACL.

Another problem (not related to commit 97d0449) is the order
get_posix_access adds missing perms.  CLASS_OBJ perms are computed
*before* missing GROUP_OBJ perms have been added.  Thus the CLASS_OBJ
perms could be too tight and led to additional, buggy DENY ACEs.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-19 16:50:15 +02:00
Corinna Vinschen 3e8f833df0 Fix outdated S_JUSTCREATED comment
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-19 16:27:07 +02:00
Corinna Vinschen 6f3943bca1 Reinstantiate Cygwin function called `__getreent'
This partially reverts commit 10a30e7 as far as the Cygwin version of
the __getreent function is concerned.  Remove _COMPILING_NEWLIB guard
only allowing to use __getreent inline function when building newlib,
since we wan to use it in Cygwin as well.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Stefan Assmann <sassmann@redhat.com>
2016-08-18 15:24:42 +02:00
Corinna Vinschen 3bbc40af2a Revert "Fix __getreent function for Cygwin"
This reverts commit 4de8596.  It worked around a problem which was
actually introduced by patch 10a30e7 a few weeks ago.  Rather than
adding special code to the newlib version of __getreent, the followup
patch reinstantiates the original, Cygwin-only implementation of
__getreent.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Stefan Assmann <sassmann@redhat.com>
2016-08-18 15:24:18 +02:00
Corinna Vinschen eb61113daf Workaround AzureAD shortcomings
No real domain, no DC, no infos via NetUserGetInfo... nothing.  Just nothing.

Use fixed uid 0x1000 (4096) for AzureAD user and gid 0x1001 (4097) for
AzureAD group.  Note that this group is part of the user token, but it's
not the primary group.  The primary group SID is, unfortunately, the
user's SID.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-18 10:27:28 +02:00
Corinna Vinschen 4de8596b8e Fix __getreent function for Cygwin
So far the lib function __getreent always returned _impure_ptr.  On Cygwin
this is only correct after _impure_ptr got initialized.  The inline
function in include/cygwin/config.h always returns the right _reent ptr,
though.

After introducing per-thread locales, the __getreent function is called
prior to initialization of _impure_ptr (from dll_crt0_0) to access the
locale pointer, which leads to a crash.

Fix the __getreent lib function for Cygwin to return the correct _reent
pointer all the time.  Rename inline function to __inline_getreent
and introduce a macro __getreent calling the inline function.  Change
the lib function __getreent to call __inline_getreent on Cygwin.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-18 10:27:14 +02:00
Corinna Vinschen 8443fcd625 Add release message for commit c02ac89
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-17 11:17:26 +02:00
Corinna Vinschen c02ac89f28 Add -i/--input option to locale(1)
The default UI language returned by GetUserDefaultUILanguage does not
necessarily reflect what the user really wants.  E. g., the system could
be en_US, but the desired language is en_CA, without having a CA langpack
installed.

Changing the settings under "Languages" and changing the keyboard layout
is only affecting the so-called  "Input language", while what's returned
by GetUserDefaultUILanguage is the "Display language".  Changing the
latter requires installing MUI langpacks.

Thus, we introduce a way to fetch the "Input language" using the -i or
--input option.

Also clean up documentation of locale(1).

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-17 10:58:04 +02:00
Corinna Vinschen a867598373 Rephrase release message
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-16 12:41:34 +02:00
Corinna Vinschen de09bb4d32 Fix typo in release message
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-16 11:22:26 +02:00
Corinna Vinschen 5dc306cf97 Add release text for Cygwin 2.6.0
Move release/2.5.3 to release/2.6.0.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 21:26:01 +02:00
Corinna Vinschen 238455adfa Implement strto[dflu]_l/wcsto[dflu]_l
Implement GNU extensions strtod_l, strtof_l, strtol_l, strtold_l, strtoll_l,
strtoul_l, strtoull_l, wcstod_l, wcstof_l, wcstol_l, wcstold_l, wcstoll_l,
wcstoul_l, wcstoull_l.

Export from Cygwin, fix posix.xml.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 17:35:21 +02:00
Corinna Vinschen 8f1378b19f Make sure alloca is called even when optimizing, fully init _REENT
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:58 +02:00
Corinna Vinschen 7156bf842e Add sys/_locale.h header and fix up headers
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:58 +02:00
Corinna Vinschen 91ebe04042 Bump CygwinAPI minor.
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:58 +02:00
Corinna Vinschen 765d2c0bac Implement strfmon_l
Use latest code from FreeBSD

Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:58 +02:00
Corinna Vinschen 542b970d4e Rename __get_locale_XXX to __get_XXX_locale to use unified naming scheme
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:58 +02:00
Corinna Vinschen c1b7d9d93d Implement per-locale string functions
strcasecmp_l, strcoll_l, strncasecmp_l, strxfrm_l,
wcscasecmp_l, wcscoll_l, wcstrncasecmp_l, wcstrxfrm_l,
strftime_l.

Add missing CHEWOUT_FILES from previous patch.

TODO: strfmon_l.

Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:58 +02:00
Corinna Vinschen 8493c16316 Implement all per-locale ctype functions
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:57 +02:00
Corinna Vinschen c402f0388f posix.xml: Note duplocale, freelocale, newlocale, uselocale as implemented
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:57 +02:00
Corinna Vinschen 1afa0fe4b3 Fix memory handling in functions called from loadlocale
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:57 +02:00
Corinna Vinschen aefd8b5b51 Implement newlocale, freelocale, duplocale, uselocale
Add global const __C_locale for reference purposes.

Bump Cygwin API minor number and DLL major version number to 2.6.0.

Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:57 +02:00
Corinna Vinschen 53f84bb5ac Rearrange struct __locale_t pointers into an array
This allows looping through the structs and buffers.  Also
rearrange definitions to follow order of LC_xxx values.

Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:57 +02:00
Corinna Vinschen 1498c79db8 Change loadlocale to fill a __locale_t given as parameter
Don't use global variables.  This allows to call loadlocale from
the yet to be created newlocale().

Rename _thr_locale_t to __locale_t (these locales are not restricted
to threads so the name is misleading).

Along these lines, fix _set_ctype to take a __locale_t as parameter.

Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:57 +02:00
Corinna Vinschen d16a56306d Consolidate wctomb/mbtowc calls for POSIX-1.2008
- Remove charset parameter from low level __foo_wctomb/__foo_mbtowc calls.
- Instead, create array of function for ISO and Windows codepages to point
  to function which does not require to evaluate the charset string on
  each call.  Create matching helper functions.  I.e., __iso_wctomb,
  __iso_mbtowc, __cp_wctomb and __cp_mbtowc are functions returning the
  right function pointer now.
- Create __WCTOMB/__MBTOWC macros utilizing per-reent locale and replace
  calls to __wctomb/__mbtowc with calls to __WCTOMB/__MBTOWC.
- Drop global __wctomb/__mbtowc vars.
- Utilize aforementioned changes in Cygwin to get rid of charset in other,
  calling functions and simplify the code.
- In Cygwin restrict global cygheap locale info to the job performed
  by internal_setlocale.  Use UTF-8 instead of ASCII on the fly in
  internal conversion functions.
- In Cygwin dll_entry, make sure to initialize a TLS area with a NULL
  _REENT->_locale pointer.  Add comment to explain why.

Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:57 +02:00
Corinna Vinschen 88208d3735 POSIX-1.2008 per-thread locales, groundwork part 2
Move all locale category structure definitions into setlocale.h and remove
other headers in locale subdir.  Create inline accessor functions for
current category struct pointers and use throughout.  Use pointers to
"C" locale category structs by default in __global_locale.

Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:56 +02:00
Corinna Vinschen a6a477fa81 POSIX-1.2008 per-thread locales, groundwork part 1
Introduce first cut of struct _thr_locale_t used for the locale_t definition.
Introduce global instance called __global_locale used by default.
Introduce internal inline functions __get_global_locale, __get_locale_r,
__get_current_locale.

Remove usage of global variables in favor of accessor functions pointing to
__global_locale for now.  Include all local headers in locale subdir from
setlocale.h to get single include for internal locale access.

Introduce __CTYPE_PTR macro to replace direct access to __ctype_ptr__
and use throughout in isxxx functions.

Signed-off by: Corinna Vinschen <corinna@vinschen.de>
2016-08-15 10:56:56 +02:00
Corinna Vinschen 9169111acf Remove unused import/rexec.c accidentally imported by commit b6e90a06
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-12 14:52:09 +02:00
Erik Bray 86f79af827 kill(pid, sig) before waitpid() returns -1 for sig != 0
This is a followup to a report back in 2011 about essentially the same issue:

https://cygwin.com/ml/cygwin/2011-04/msg00031.html

The same test program in that report demonstrates the issue, but with
kill sending any non-zero signal.  To reiterate, the problem here is
POSIX compliance with respect to sending signals to zombie processes.

http://pubs.opengroup.org/onlinepubs/9699919799/functions/kill.html
claims:

  Existing implementations vary on the result of a kill() with pid
  indicating an inactive process (a terminated process that has not been
  waited for by its parent). Some indicate success on such a call
  (subject to permission checking), while others give an error of
  [ESRCH].  Since the definition of process lifetime in this volume of
  POSIX.1-2008 covers inactive processes, the [ESRCH] error as described
  is inappropriate in this case. In particular, this means that an
  application cannot have a parent process check for termination of a
  particular child with kill().  (Usually this is done with the null
  signal; this can be done reliably with waitpid().)

In response to the originally issue, this was fixed *specifically* for
the case of kill(pid, 0).  But my reading of the above is that kill()
should return 0 in this case regardless of the signal (modulo
permissions, etc.).  On Linux, for example, when calling kill with pid
of a zombie process the kernel will happily deliver the signal to the
relevant task_struct; it will just never be acted on since the task
will never run again.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-11 15:57:53 +02:00
Corinna Vinschen 9c4113f0c7 Workaround for filesystems with broken FileAllInformation info class (NcFsd)
See discussion starting at https://cygwin.com/ml/cygwin/2016-07/msg00350.html

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-05 10:47:37 +02:00
Corinna Vinschen 99a3f266c1 Fix console clear screen if buffer is full
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-03 14:34:01 +02:00
Corinna Vinschen 05847ad6e9 Fix console clear screen in case of partial scrolling
Commit d7586cb incorrectly checked only for the new cursor position
beyond the old cursor position to decide if we have to correct for user
scrolling.  Since this situation is handled just fine if the cursor is
still visible, only perform the subsequent correction if the cursor is
not in the visible console window.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-01 12:42:54 +02:00
Corinna Vinschen 11dcf9cb5c Open process with PROCESS_QUERY_INFORMATION to fetch maps
Commit ba58e5f lowered permission requirements when opening threads
and processes to {PROCESS,THREAD}_QUERY_LIMITED_INFORMATION.  However,
when creating the /proc/<PID>/maps file, the call to VirtualQueryEx
requires PROCESS_QUERY_INFORMATION access

Note: It seems PROCESS_QUERY_LIMITED_INFORMATION is sufficient starting
with Windows 8.1, but this is neither documented on MSDN, nor is it a
safe bet.  It may have to do with a fixed implementation of the UAC
trust levels.  Let's better follow the docs for now.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-01 11:52:30 +02:00
Corinna Vinschen d7586cb66c Fix clear screen behaviour of console when user scrolled up or down
We must call SetConsoleCursorPosition prior to SetConsoleWindowInfo,
otherwise the scroll bars will not be updated by the OS.  Make sure
to scroll the console window by just the right amount to have the
new cursor position one line after the used console buffer area at
the top of the console window, no matter the scroll state.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-07-29 12:07:46 +02:00
Corinna Vinschen 08da3bfc41 Fix buffer scrolling when performing a "clear screen"
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-07-28 08:50:09 +02:00
Corinna Vinschen 32b668d966 Don't raise SIGTTIN from poll/select
SIGTTIN should be raised when read() is made on a tty in a backgrounded
process, but not when it's tested with poll()/select().

I guess poll()/select() does need to call bg_check(), in order to detect the
error conditions that notices (that is, if bg_check() returns bg_eof or
bg_error, then fd is ready as an error condition exists) so add an optional
parameter to fhandler_base::bg_select() to indicate that signals aren't
desired.

See https://cygwin.com/ml/cygwin-developers/2016-07/msg00004.html
2016-07-27 17:02:08 +01:00
Corinna Vinschen 10a30e7a25 Remove redundant macro and function called `__getreent'
Just rely on the inline version in include/cygwin/config.h

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-07-27 14:00:30 +02:00
Corinna Vinschen 886f89ac39 posix.xml: Add missing unimplemented functions from POSIX-1.2013
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-07-23 13:56:52 +02:00
Corinna Vinschen 25cb82a55e Change "nodomain+nobody" to "no+body"
Per https://cygwin.com/ml/cygwin-apps/2016-07/msg00059.html

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-07-22 09:41:23 +02:00
Corinna Vinschen 1a988fc6ba Handle WinFSP nobody account
Per discussion started at
https://cygwin.com/ml/cygwin/2016-06/msg00347.html

S-1-0-65534 == uid/gid 65534 == nodomain+nobody

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-07-19 11:14:50 +02:00
Corinna Vinschen 642c48095c Fix typo
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-07-18 22:03:37 +02:00
Corinna Vinschen 2082bcec41 Add release message for commit 71df3bf
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-07-18 22:03:00 +02:00
Corinna Vinschen 71df3bfd51 truncl: Fix setting rounding bits in FPU control word
Mingw-w64, which is the source of this code, uses different
definitions of the rounding bits FE_TONEAREST and friends.
They immediately reflect the bit values in the FPU control word,
while on Cygwin they are shifted down to become the values 0-3.

Fix the bit computing expression to account for the difference.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-07-18 22:00:17 +02:00
Eric Blake 7475b656f4 Put previous doc in correct section
SSIZE_MAX was a bug fix, not a huge change.

Signed-off-by: Eric Blake <eblake@redhat.com>
2016-07-14 13:26:29 -06:00
Corinna Vinschen 863952f273 Add release message for commit fe9e3b4
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-07-14 20:55:04 +02:00
Corinna Vinschen fe9e3b4498 Transform all special chars in relative Windows path string
get_nt_native_path handles the transposition of chars not allowed
in Windows pathnames.  However, it never starts transposition at
the start of the string, which is wrong for relative paths.  Fix it.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-07-14 20:52:04 +02:00
Eric Blake 6795ef7d37 Fix 32-bit SSIZE_MAX
POSIX requires that SSIZE_MAX have the same type as ssize_t, but
on 32-bit, we were defining it as a long even though ssize_t
resolves to an int.  It also requires that SSIZE_MAX be usable
via preprocessor #if, so we can't cheat and use a cast.

If this were newlib, I'd have had to hack _intsup.h to probe the
qualities of size_t (via gcc's __SIZE_TYPE__), similar to how we
already probe the qualities of int8_t and friends, then cross our
fingers that ssize_t happens to have the same rank (most systems
do, but POSIX permits a system where they differ such as size_t
being long while ssize_t is int).  Unfortunately gcc gives us
neither __SSIZE_TYPE__ nor __SSIZE_MAX__.  On the other hand, our
limits.h is specific to cygwin, so we can just shortcut to the
correct results rather than being generic to all possible ABI.

Signed-off-by: Eric Blake <eblake@redhat.com>
2016-07-14 12:38:49 -06:00
Corinna Vinschen 87076a3a83 Add release message for commit 82e0649
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-07-14 19:11:45 +02:00