From 13b8101061b2e5824c0e0a08654922649acf4978 Mon Sep 17 00:00:00 2001 From: monarch dodra Date: Wed, 4 Dec 2013 00:07:47 -0800 Subject: [PATCH 1/7] Merge pull request #1744 from 9rnsr/fix11603 Issue 11603 - std.algorithm.canFind does not work when needle is 1-byte zero --- std/algorithm.d | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/std/algorithm.d b/std/algorithm.d index a2651a6c01d..4292a662cae 100644 --- a/std/algorithm.d +++ b/std/algorithm.d @@ -3998,6 +3998,15 @@ unittest dg(); assertCTFEable!dg; } +unittest +{ + // Bugzilla 11603 + enum Foo : ubyte { A } + assert([Foo.A].find(Foo.A).empty == false); + + ubyte x = 0; + assert([x].find(x).empty == false); +} unittest { From 67933fda951ccd8735eb66ea223980ae7175bc11 Mon Sep 17 00:00:00 2001 From: monarch dodra Date: Mon, 9 Dec 2013 03:18:56 -0800 Subject: [PATCH 2/7] Merge pull request #1751 from dawgfoto/std_zip [install,regression] fix Issue 11692 - can't set file attributes for std.zip.ArchiveMember --- std/zip.d | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/std/zip.d b/std/zip.d index b844efd1870..d256a5a0403 100644 --- a/std/zip.d +++ b/std/zip.d @@ -84,9 +84,16 @@ final class ArchiveMember private ushort _madeVersion = 20; private ushort _extractVersion = 20; private ushort _diskNumber; +<<<<<<< HEAD private uint _externalAttributes; private DosFileTime _time; +======= + // should be private when deprecation done + deprecated("Please use fileAttributes instead.") uint externalAttributes; + + std.datetime.DosFileTime time; /// Read/Write: Last modified time of the member. DOS date/time format. +>>>>>>> Merge pull request #1751 from dawgfoto/std_zip ushort flags; /// Read/Write: normally set to 0 ushort internalAttributes; /// Read/Write @@ -131,13 +138,21 @@ final class ArchiveMember { version (Posix) { +<<<<<<< HEAD _externalAttributes = (attr & 0xFFFF) << 16; +======= + externalAttributes = attr & 0xFF << 16; +>>>>>>> Merge pull request #1751 from dawgfoto/std_zip _madeVersion &= 0x00FF; _madeVersion |= 0x0300; // attributes are in UNIX format } else version (Windows) { +<<<<<<< HEAD _externalAttributes = attr; +======= + externalAttributes = attr; +>>>>>>> Merge pull request #1751 from dawgfoto/std_zip _madeVersion &= 0x00FF; // attributes are in MS-DOS and OS/2 format } else @@ -146,6 +161,7 @@ final class ArchiveMember } } +<<<<<<< HEAD version (Posix) unittest { auto am = new ArchiveMember(); @@ -154,6 +170,8 @@ final class ArchiveMember assert((am._madeVersion & 0xFF00) == 0x0300); } +======= +>>>>>>> Merge pull request #1751 from dawgfoto/std_zip /** * Get the OS specific file attributes for the archive member. * @@ -166,13 +184,21 @@ final class ArchiveMember version (Posix) { if ((_madeVersion & 0xFF00) == 0x0300) +<<<<<<< HEAD return _externalAttributes >> 16; +======= + return externalAttributes >> 16; +>>>>>>> Merge pull request #1751 from dawgfoto/std_zip return 0; } else version (Windows) { if ((_madeVersion & 0xFF00) == 0x0000) +<<<<<<< HEAD return _externalAttributes; +======= + return externalAttributes; +>>>>>>> Merge pull request #1751 from dawgfoto/std_zip return 0; } else @@ -181,6 +207,7 @@ final class ArchiveMember } } +<<<<<<< HEAD /// Set the last modification time for this member. @property void time(SysTime time) { @@ -199,15 +226,21 @@ final class ArchiveMember return _time; } +======= +>>>>>>> Merge pull request #1751 from dawgfoto/std_zip /** * Read compression method used for this member * See_Also: * CompressionMethod **/ @property CompressionMethod compressionMethod() { return _compressionMethod; } +<<<<<<< HEAD deprecated("Please use the enum CompressionMethod to set this property instead.") @property void compressionMethod(ushort cm) +======= + deprecated @property void compressionMethod(ushort cm) +>>>>>>> Merge pull request #1751 from dawgfoto/std_zip { compressionMethod = cast(CompressionMethod)(cm); } From 6ceef71172591ee013dee4c87f6b1e257b629fcc Mon Sep 17 00:00:00 2001 From: Martin Nowak Date: Thu, 19 Dec 2013 19:05:53 +0100 Subject: [PATCH 3/7] Revert "Merge pull request #1751 from dawgfoto/std_zip" This reverts commit 67933fda951ccd8735eb66ea223980ae7175bc11. --- std/zip.d | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/std/zip.d b/std/zip.d index d256a5a0403..b844efd1870 100644 --- a/std/zip.d +++ b/std/zip.d @@ -84,16 +84,9 @@ final class ArchiveMember private ushort _madeVersion = 20; private ushort _extractVersion = 20; private ushort _diskNumber; -<<<<<<< HEAD private uint _externalAttributes; private DosFileTime _time; -======= - // should be private when deprecation done - deprecated("Please use fileAttributes instead.") uint externalAttributes; - - std.datetime.DosFileTime time; /// Read/Write: Last modified time of the member. DOS date/time format. ->>>>>>> Merge pull request #1751 from dawgfoto/std_zip ushort flags; /// Read/Write: normally set to 0 ushort internalAttributes; /// Read/Write @@ -138,21 +131,13 @@ final class ArchiveMember { version (Posix) { -<<<<<<< HEAD _externalAttributes = (attr & 0xFFFF) << 16; -======= - externalAttributes = attr & 0xFF << 16; ->>>>>>> Merge pull request #1751 from dawgfoto/std_zip _madeVersion &= 0x00FF; _madeVersion |= 0x0300; // attributes are in UNIX format } else version (Windows) { -<<<<<<< HEAD _externalAttributes = attr; -======= - externalAttributes = attr; ->>>>>>> Merge pull request #1751 from dawgfoto/std_zip _madeVersion &= 0x00FF; // attributes are in MS-DOS and OS/2 format } else @@ -161,7 +146,6 @@ final class ArchiveMember } } -<<<<<<< HEAD version (Posix) unittest { auto am = new ArchiveMember(); @@ -170,8 +154,6 @@ final class ArchiveMember assert((am._madeVersion & 0xFF00) == 0x0300); } -======= ->>>>>>> Merge pull request #1751 from dawgfoto/std_zip /** * Get the OS specific file attributes for the archive member. * @@ -184,21 +166,13 @@ final class ArchiveMember version (Posix) { if ((_madeVersion & 0xFF00) == 0x0300) -<<<<<<< HEAD return _externalAttributes >> 16; -======= - return externalAttributes >> 16; ->>>>>>> Merge pull request #1751 from dawgfoto/std_zip return 0; } else version (Windows) { if ((_madeVersion & 0xFF00) == 0x0000) -<<<<<<< HEAD return _externalAttributes; -======= - return externalAttributes; ->>>>>>> Merge pull request #1751 from dawgfoto/std_zip return 0; } else @@ -207,7 +181,6 @@ final class ArchiveMember } } -<<<<<<< HEAD /// Set the last modification time for this member. @property void time(SysTime time) { @@ -226,21 +199,15 @@ final class ArchiveMember return _time; } -======= ->>>>>>> Merge pull request #1751 from dawgfoto/std_zip /** * Read compression method used for this member * See_Also: * CompressionMethod **/ @property CompressionMethod compressionMethod() { return _compressionMethod; } -<<<<<<< HEAD deprecated("Please use the enum CompressionMethod to set this property instead.") @property void compressionMethod(ushort cm) -======= - deprecated @property void compressionMethod(ushort cm) ->>>>>>> Merge pull request #1751 from dawgfoto/std_zip { compressionMethod = cast(CompressionMethod)(cm); } From e7cb5f7838e45f71910b6b6fbe4abebc84f42dba Mon Sep 17 00:00:00 2001 From: Martin Nowak Date: Sat, 21 Dec 2013 23:29:41 +0100 Subject: [PATCH 4/7] Merge pull request #1772 from MartinNowak/fix10710 fix Issue 10710 - phobos depends on versioned libcurl Conflicts: posix.mak --- etc/c/curl.d | 2 +- posix.mak | 18 +++++++++++++----- std/net/curl.d | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/etc/c/curl.d b/etc/c/curl.d index 7c58e37383f..d28c3bfbb59 100644 --- a/etc/c/curl.d +++ b/etc/c/curl.d @@ -31,7 +31,7 @@ module etc.c.curl; -pragma(lib, "curl"); +version (Windows) pragma(lib, "curl"); import core.stdc.time; import core.stdc.config; diff --git a/posix.mak b/posix.mak index 63c072a43a3..3aaea6800ef 100644 --- a/posix.mak +++ b/posix.mak @@ -168,6 +168,9 @@ else LIB:=$(ROOT)/phobos.lib endif +LIBCURL_STUB:=$(if $(findstring $(OS),linux),$(ROOT)/libcurl_stub.so,) +LINKCURL:=$(if $(LIBCURL_STUB),-L$(LIBCURL_STUB),-L-lcurl) + ################################################################################ MAIN = $(ROOT)/emptymain.d @@ -282,8 +285,13 @@ $(ROOT)/libphobos2.so: $(ROOT)/$(SONAME) $(ROOT)/$(SONAME): $(LIBSO) ln -sf $(notdir $(LIBSO)) $@ -$(LIBSO): $(OBJS) $(ALL_D_FILES) $(DRUNTIME) - $(DMD) $(DFLAGS) -shared -debuglib= -defaultlib= -of$@ -L-soname=$(SONAME) $(DRUNTIMESO) $(LINKDL) $(D_FILES) $(OBJS) +$(LIBSO): $(OBJS) $(ALL_D_FILES) $(DRUNTIME) $(LIBCURL_STUB) + $(DMD) $(DFLAGS) -shared -debuglib= -defaultlib= -of$@ -L-soname=$(SONAME) $(DRUNTIMESO) $(LINKDL) $(LINKCURL) $(D_FILES) $(OBJS) + +# stub library with soname of the real libcurl.so (Bugzilla 10710) +$(LIBCURL_STUB): + @echo "void curl_global_init() {}" > $(ROOT)/libcurl_stub.c + $(CC) -shared $(CFLAGS) $(ROOT)/libcurl_stub.c -o $@ -Wl,-soname=libcurl.so.4 ifeq (osx,$(OS)) # Build fat library that combines the 32 bit and the 64 bit libraries @@ -311,15 +319,15 @@ $(UT_D_OBJS): $(ROOT)/unittest/%.o: %.d ifneq (linux,$(OS)) $(ROOT)/unittest/test_runner: $(DRUNTIME_PATH)/src/test_runner.d $(UT_D_OBJS) $(OBJS) $(DRUNTIME) - $(DMD) $(DFLAGS) -unittest -of$@ $(DRUNTIME_PATH)/src/test_runner.d $(UT_D_OBJS) $(OBJS) $(DRUNTIME) -defaultlib= -debuglib= -L-lcurl + $(DMD) $(DFLAGS) -unittest -of$@ $(DRUNTIME_PATH)/src/test_runner.d $(UT_D_OBJS) $(OBJS) $(DRUNTIME) $(LINKCURL) -defaultlib= -debuglib= else UT_LIBSO:=$(ROOT)/unittest/libphobos2-ut.so $(UT_LIBSO): override PIC:=-fPIC -$(UT_LIBSO): $(UT_D_OBJS) $(OBJS) $(DRUNTIMESO) - $(DMD) $(DFLAGS) -shared -unittest -of$@ $(UT_D_OBJS) $(OBJS) $(DRUNTIMESO) $(LINKDL) -defaultlib= -debuglib= -L-lcurl +$(UT_LIBSO): $(UT_D_OBJS) $(OBJS) $(DRUNTIMESO) $(LIBCURL_STUB) + $(DMD) $(DFLAGS) -shared -unittest -of$@ $(UT_D_OBJS) $(OBJS) $(DRUNTIMESO) $(LINKDL) $(LINKCURL) -defaultlib= -debuglib= $(ROOT)/unittest/test_runner: $(DRUNTIME_PATH)/src/test_runner.d $(UT_LIBSO) $(DMD) $(DFLAGS) -of$@ $< -L$(UT_LIBSO) -defaultlib= -debuglib= diff --git a/std/net/curl.d b/std/net/curl.d index 4bcf494bb4a..2ed1f5df61a 100644 --- a/std/net/curl.d +++ b/std/net/curl.d @@ -188,7 +188,7 @@ version(unittest) } version(StdDdoc) import std.stdio; -pragma(lib, "curl"); +version (Windows) pragma(lib, "curl"); extern (C) void exit(int); // Default data timeout for Protcools From b6192cecfe981fc436b0b579069cf7760630a88e Mon Sep 17 00:00:00 2001 From: k-hara Date: Mon, 23 Dec 2013 09:20:44 +0900 Subject: [PATCH 5/7] Revert "Merge pull request #1744 from 9rnsr/fix11603" This reverts commit 13b8101061b2e5824c0e0a08654922649acf4978. --- std/algorithm.d | 9 --------- 1 file changed, 9 deletions(-) diff --git a/std/algorithm.d b/std/algorithm.d index 4292a662cae..a2651a6c01d 100644 --- a/std/algorithm.d +++ b/std/algorithm.d @@ -3998,15 +3998,6 @@ unittest dg(); assertCTFEable!dg; } -unittest -{ - // Bugzilla 11603 - enum Foo : ubyte { A } - assert([Foo.A].find(Foo.A).empty == false); - - ubyte x = 0; - assert([x].find(x).empty == false); -} unittest { From a087fcb2c39ae13e8a0c3eb2494adae15683c6ee Mon Sep 17 00:00:00 2001 From: Martin Nowak Date: Sat, 28 Dec 2013 02:55:28 +0100 Subject: [PATCH 6/7] fix Issue 11831 - std.zip no longer allows setting madeVersion field - add deprecated ref accessor --- std/zip.d | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/std/zip.d b/std/zip.d index b844efd1870..dd2260944a2 100644 --- a/std/zip.d +++ b/std/zip.d @@ -90,12 +90,16 @@ final class ArchiveMember ushort flags; /// Read/Write: normally set to 0 ushort internalAttributes; /// Read/Write - @property ushort madeVersion() { return _madeVersion; } /// Read Only @property ushort extractVersion() { return _extractVersion; } /// Read Only @property uint crc32() { return _crc32; } /// Read Only: cyclic redundancy check (CRC) value /// OS specific file attributes deprecated("Please use fileAttributes instead.") + @property ref inout(ushort) madeVersion() inout @safe pure nothrow + { return _madeVersion; } + + // Explicitly undocumented. It will be removed in January 2015. + deprecated("Please use fileAttributes instead.") @property ref inout(uint) externalAttributes() inout @safe pure nothrow { return _externalAttributes; } From 55c83ed471c93f9912ca8f5b2c78225567cc0a2d Mon Sep 17 00:00:00 2001 From: Martin Nowak Date: Sat, 21 Dec 2013 22:27:01 +0100 Subject: [PATCH 7/7] fix Issue 11789 - No setAttributes to complement getAttributes - add std.file.setAttributes [Issue 11789](https://d.puremagic.com/issues/show_bug.cgi?id=11789) --- std/file.d | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/std/file.d b/std/file.d index 8cbe5f0e7d5..ed38c4184c4 100644 --- a/std/file.d +++ b/std/file.d @@ -966,6 +966,26 @@ uint getLinkAttributes(in char[] name) } +/++ + Set the attributes of the given file. + + Throws: + $(D FileException) if the given file does not exist. + +/ +void setAttributes(in char[] name, uint attributes) +{ + version (Windows) + { + cenforce(SetFileAttributesW(std.utf.toUTF16z(name), attributes), name); + } + else version (Posix) + { + assert(attributes <= mode_t.max); + cenforce(!chmod(toStringz(name), cast(mode_t)attributes), name); + } +} + + /++ Returns whether the given file is a directory.