Commit graph

84 commits

Author SHA1 Message Date
Reece Dunham 8b3937ecfe
CodeFactor cleanup (#12251)
* Code cleanup

Signed-off-by: Reece Dunham <me@rdil.rocks>

* whoops

* Update src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionOperations.cs

Co-Authored-By: Travis Plunk <travis.plunk@microsoft.com>

Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
2020-04-14 14:34:53 -07:00
Aditya Patwardhan b42c001700 Cleanup all native code from repository (#7892)
Native code for PowerShell has been moved to repository PowerShell/PowerShell-Native.

Hence, removing all the native code and related build components.
2018-10-02 12:48:42 -07:00
Aditya Patwardhan 749d1609bb
Update README files for native code for migration (#7248) 2018-07-11 14:32:01 -07:00
Steve Lee 7d72e38604 Updates to build for Alpine (#7139)
setdate.cpp was incorrectly assigning an int to a struct, fixed to initialize struct zero'd
update the typegen project in the bash script
added some help text at top of script for someone trying to build it
updated runtime to linux-musl-x64 instead of linux-x64 as Alpine distro uses the musl libc libraries instead of glibc which is used by most distros.
2018-06-25 14:51:30 -07:00
Travis Plunk b43d3e5d00
stop corrupting memory in libpsl-native SetDate (#6881)
stop corrupting memory in libpsl-native SetDate
Addresses #6872 - the first step
2018-05-18 12:56:09 -07:00
Patochun 145cb77226 Update Tests Isfile to correct response for "/" (#6754)
I Think the good answer for "/" is a directory, not a file.
So I recommand to change EXPECT_TRUE by EXPECT_FALSE for this case.
2018-05-03 14:28:44 -07:00
kasper3 271dd50df2 Add Alpine Linux support (#6367)
sys/sysctl header is not available in musl-libc based systems and system calls are available without any header inclusion. I have ported the cmake test from CoreFX repo (https://github.com/dotnet/corefx/blob/431475b8/src/Native/Unix/configure.cmake#L560).

Progress towards: #4605
2018-03-20 13:34:18 -07:00
Steve Lee c1c5344a88 Update copyright and license headers (#6134)
Based on standard practices, we need to have a copyright and license notice at the top of each source file. Removed existing copyrights and updated/added copyright notices for .h, .cpp, .cs, .ps1, and .psm1 files.

Updated module manifests for consistency to have Author = "PowerShell" and Company = "Microsoft Corporation". Removed multiple line breaks.

Separate PR coming to update contribution document for new source files: #6140

Manually reviewed each change.

Fix #6073
2018-02-13 09:23:53 -08:00
Travis Plunk 9559694191
Replace strlen with strnlen in native code (#5510)
* fix expected vs actual for easier troubleshooting
* replace strlen calls with strnlen
2017-11-21 16:20:25 -08:00
Dan Travison ed499ced53 Use native os_log APIs on OSX for PowerShell logging (#5310) 2017-11-03 10:56:35 -07:00
Dan Travison 053d180817 Add exports for syslog APIs in 'libpsl-native'. (#5149) 2017-10-20 09:03:59 -07:00
Travis Plunk db6aec0850 Add compiler switches replace dangerous function with safer ones. (#5089)
* Add compiler switches replace the dangerous function with safer ones.
* Add -02 and make linker flags per platform
* add -O2 for arm and add -z,now
* remove windows linker flags
2017-10-18 10:08:11 -07:00
Steve Lee 2639cd89ce Autocorrected CRLF to LF (#4943)
Also, fix `Parser.Tests.ps1` after correcting CRLF.
2017-09-29 16:28:15 -07:00
Travis Plunk df1993aad0 Enable security flags in native compiler (#4933)
* Enable strong stack protection
Enable  address space layout randomization (ASLR) or PIE

* Enable strong stack protection
Enable  address space layout randomization (ASLR) or PIE
2017-09-27 15:35:23 -07:00
Steve Lee 6f1c7a05c6 Enable cross compiling for raspberry-pi arm32 (#4742) 2017-09-11 12:16:58 -07:00
jeffbi 1688703caf Make Get-ChildItem follow symlinks on demand, with checks for link loops (#4020)
Add the dynamic parameter `-FollowSymlink` to `Get-ChildItem`.
Add a mechanism for tracking visited directories.
Add native code to get device/inode information on Unix/Windows.
Add warning when refusing to enter an already-visited directory.
2017-07-06 12:28:27 -07:00
Paul Higinbotham 578f9e5e8b Fix Linux platform SSH process creation for remoting (#3901)
* Fix SSH process creation on Linux platforms

* Fixed typos

* Added UNIX managed code StartProcess

* Fixed compile errors

* Changed process create to return pid

* Now resolve full SSH command file path for all platforms

* Removed data reader error handling because it conflicts with SSH errors in the error stream

* Clean up work

* Fix for file line endings

* More clean up

* Change to Linux platform SSH process creation to create process in new session

* Added third party license text for DotNet Core

* Removed process creation in new session and added suppress SIGINT

* Removed unneeded code for creating SSH process

* Fixed Unix compile errors

* Changes for code review

* Response to more code review comments

* Removed unneeded using statements
2017-06-14 15:56:56 -07:00
jeffbi 8183732d99 Use more accurate test to check if source and destination paths are pointing the same file (#3441)
Rather than relying on case-insensitive string compares of source and destination paths, use operating system calls to determine whether two paths refer to the same file. This solves not only the case-insensitivity issue but also allows the cmdlet to operate properly if the destination is a hard or symbolic link to the source.
The Windows side is implemented in C#. The Unix side is implemented partially in native code.
2017-04-21 16:09:53 -07:00
Staffan Gustafsson b4049879d4 Adding Parent extended property to System.Diagnostics.Process (#2850) 2017-03-06 15:21:39 -08:00
Alessandro Pilotti 15ed125c4a Fixes deprecated syscall issue on macOS 10.12 (#2633) (#2675)
syscall() has been deprecated and is not available on macOS 10.12.
2016-11-16 16:26:46 -08:00
Andrew Schwartzmeyer 07a1841eb6 Set libpsl-native configuration to release
This disables asserts.
2016-10-14 15:43:00 -07:00
Andrew Schwartzmeyer e630c6f79c Fix GetCurrentThreadId 2016-10-14 15:43:00 -07:00
Andrew Schwartzmeyer 24d0ce36e6 Fix SetDate
And use a bunch of unsafe code because of concerns about stack size.
2016-10-14 15:43:00 -07:00
Andrew Schwartzmeyer cdcd2c25c8 Remove Windows ERROR codes from pal.h 2016-10-14 15:43:00 -07:00
Andrew Schwartzmeyer 011d947fd5 Clean up GetFileOwner 2016-10-14 15:43:00 -07:00
Andrew Schwartzmeyer 4038cd61f2 Clean up IsExecutable 2016-10-14 15:42:59 -07:00
Andrew Schwartzmeyer 8b3e8be1bc Clean up IsDirectory 2016-10-14 15:42:59 -07:00
Andrew Schwartzmeyer 2a6b84ed1b Clean up IsHardLink 2016-10-14 15:42:59 -07:00
Andrew Schwartzmeyer e343e8ec60 Clean up GetUserFromPid 2016-10-14 15:42:59 -07:00
Andrew Schwartzmeyer 14e2389e71 Clean up GetComputerName 2016-10-14 15:42:59 -07:00
Andrew Schwartzmeyer 1d240ef3e4 Remove GetLStat 2016-10-14 15:42:59 -07:00
Andrew Schwartzmeyer b4b2278571 Clean up CreateHardLink 2016-10-14 15:42:58 -07:00
Andrew Schwartzmeyer 0ce5575f57 Clean up CreateSymLink 2016-10-14 15:42:58 -07:00
Andrew Schwartzmeyer bdfe69355f Clean up GetComputerName 2016-10-14 15:30:19 -07:00
Andrew Schwartzmeyer 82867a5c12 Clean up FollowSymLink 2016-10-14 15:30:19 -07:00
Andrew Schwartzmeyer fc5a1ae6aa Clean up SetDate
Remove pass-by-reference from C API
2016-10-14 15:30:19 -07:00
Andrew Schwartzmeyer 196a37b118 Add native errno to ErrorCategory mapper 2016-10-14 15:30:19 -07:00
Andrew Schwartzmeyer e1aeeaa9c2 Switch to Win32Exception(GetLastWin32Error)
This is verified to work "correctly" on Linux in that it gets the
`perror` for the last set value of errno in native code.

No extra mapping or handling needs to be done on our part.

Keeping the strerror_r implementation in the history for the valuable
implementation of config.h.in in the library.
2016-10-14 15:30:19 -07:00
Andrew Schwartzmeyer 6c3e536ca8 Add configure to CMake to detect GNU strerror_r
* Add getstrerror to libpsl-native
* Add Unix.GetLastPerror to CorePsPlatform
2016-10-14 15:30:19 -07:00
Andrew Schwartzmeyer b0cd7ba3dc Clean up libpsl-native headers 2016-10-14 15:30:19 -07:00
Andrew Schwartzmeyer e7537b7ef4 Improve GetFullyQualfiedName() test 2016-09-12 15:01:18 -07:00
Andrew Schwartzmeyer b86b1f870a Fix memory leak in GetFullyQualifiedName() 2016-09-12 15:01:18 -07:00
Ben Tucker 7071137085 Fix test-locale.cpp to report failing value (#2191)
ASSERT_TRUE("a"=="b") only reports that the strings do not match, hiding
their values.
ASSERT_STREQ("a","b") is a functionally equivalent test, but reports
back the values of the failing strings for easier troubleshooting.
2016-09-08 13:44:13 -07:00
Sergei Vorobev 7a89b33f8b Merge pull request #2154 from jsoref/spelling-locals
Spelling locals
2016-09-06 12:18:33 -07:00
Andrew Schwartzmeyer 683e6fbe36 Remove incorrect logic from GetFullyQualifiedName()
I think this logic was originally added with the assumption that any
hostname with a dot in it was an FQDN. I believe this is incorrect. The
hostname is the hostname regardless of included dots, and getting the
FQDN amounts to always querying for the canonical name.
2016-09-02 10:27:11 -07:00
Josh Soref 96e9b64b65 spelling: locals in src/libpsl-native/test 2016-08-28 07:04:51 +00:00
Josh Soref eb3fd7ae6c Spelling comments (#2066)
* spelling: comments in src/Microsoft.Management.Infrastructure.CimCmdlets

* spelling: comments in src/Microsoft.PackageManagement.ArchiverProviders

* spelling: comments in src/Microsoft.PackageManagement.CoreProviders

* spelling: comments in src/Microsoft.PackageManagement.MetaProvider.PowerShell

* spelling: comments in src/Microsoft.PackageManagement.MsiProvider

* spelling: comments in src/Microsoft.PackageManagement.MsuProvider

* spelling: comments in src/Microsoft.PackageManagement.NuGetProvider

* spelling: comments in src/Microsoft.PackageManagement.PackageSourceListProvider

* spelling: comments in src/Microsoft.PackageManagement

* spelling: comments in src/Microsoft.PowerShell.Activities

* spelling: comments in src/Microsoft.PowerShell.Commands.Diagnostics

* spelling: comments in src/Microsoft.PowerShell.Commands.Management

* spelling: comments in src/Microsoft.PowerShell.Commands.Utility

* spelling: comments in src/Microsoft.PowerShell.ConsoleHost

* spelling: comments in src/Microsoft.PowerShell.Core.Activities

* spelling: comments in src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext

* spelling: comments in src/Microsoft.PowerShell.CoreCLR.Eventing

* spelling: comments in src/Microsoft.PowerShell.Diagnostics.Activities

* spelling: comments in src/Microsoft.PowerShell.GraphicalHost

* spelling: comments in src/Microsoft.PowerShell.LocalAccounts

* spelling: comments in src/Microsoft.PowerShell.Management.Activities

* spelling: comments in src/Microsoft.PowerShell.PSReadLine

* spelling: comments in src/Microsoft.PowerShell.PackageManagement

* spelling: comments in src/Microsoft.PowerShell.ScheduledJob

* spelling: comments in src/Microsoft.PowerShell.Security.Activities

* spelling: comments in src/Microsoft.PowerShell.Security

* spelling: comments in src/Microsoft.PowerShell.Utility.Activities

* spelling: comments in src/Microsoft.PowerShell.Workflow.ServiceCore

* spelling: comments in src/Microsoft.WSMan.Management.Activities

* spelling: comments in src/Modules

* spelling: comments in src/Schemas

* spelling: comments in src/libpsl-native

* spelling: comments in src/powershell-native

* spelling: comments in build.psm1

* spelling: comments in src/System.Management.Automation/CoreCLR

* spelling: comments in src/System.Management.Automation/DscSupport

* spelling: comments in src/System.Management.Automation/cimSupport

* spelling: comments in src/System.Management.Automation/commands

* spelling: comments in src/System.Management.Automation/engine/Modules
2016-08-26 13:46:03 -07:00
Andy Schwartzmeyer 550a21e40e Fix GetFullyQualifiedName() (#1915)
Don't expect GetComputerName() (hostname) and FQDN to be the same. They
may not be!
2016-08-18 15:25:47 -07:00
Sergei Vorobev 7f274a356d Update building/internals.md docs 2016-07-22 16:11:38 -07:00
Andrew Schwartzmeyer ed39a00f29 Add GetLStat
faccessat() does not support AT_SYMLINK_NOFOLLOW on OS X, so instead,
we use the success of lstat() to determine if the file (not following
symbolic links) exists. Also allowed for some refactoring.
2016-07-14 19:45:14 -07:00