weixin_39751327
weixin_39751327
2020-12-29 10:44

Pipeline looks for temp folder env variable which is not present on *nix machines

The BufferingHelper tries to get the path to the temporary folder by reading the environmental variables 'ASPNET_TEMP' and 'TEMP'. Code The issue is *nix machines don't have the mandatory 'TEMP' variable set by default.

discussed that Path.GetTempPath was not advised to be used while Environment.SpecialFolder is not present for Core CLR.

This leaves us with two options - Find a variable similar to 'TEMP' which is set by default and read the path value from there - Document this and have administrators set this variable on the machines.

The second one I am not comfortable with while the first one, I was not able to get a consistent variable that is similar to 'TEMP'. The OSX has 'TMPDIR' but this is not present in Linux machines. With the latest bits, running applications without either of these variables set results in error which are not very obvious either. Can we come at a consensus on what the guidelines should be ?

该提问来源于开源项目:aspnet/HttpAbstractions

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

10条回答

  • weixin_39729837 weixin_39729837 4月前

    Mono's implementation of Path.GetTempPath() - https://github.com/mono/mono/blob/master/mcs/class/corlib/System.IO/Path.cs#L468

    点赞 评论 复制链接分享
  • weixin_39781550 weixin_39781550 4月前

    Can you have a look?

    点赞 评论 复制链接分享
  • weixin_39810196 weixin_39810196 4月前

    sure.

    点赞 评论 复制链接分享
  • weixin_39905816 weixin_39905816 4月前

    To save everyone a few clicks, this is what Mono ends up doing: https://github.com/mono/mono/blob/effa4c07ba850bedbe1ff54b2a5df281c058ebcb/eglib/src/gmisc-unix.c#L132-L151

    点赞 评论 复制链接分享
  • weixin_39810196 weixin_39810196 4月前

    I have a proposal on this to check for folders in the following order (1 & 2 is what we have today). 1. ASPNET_TEMP - User set location for ASP.NET apps 2. TEMP - Works on windows points to appdata\local 3. TMPDIR - works on Mac and some linux distributions like Ubuntu 4. TMP 5. /tmp Looks like this is a recommendation - http://www.pathname.com/fhs/pub/fhs-2.3.html#TMPTEMPORARYFILES

    Thoughts?

    点赞 评论 复制链接分享
  • weixin_39729837 weixin_39729837 4月前

    I like it. I would file a bug on the corefx repository with this as well. Ideally we'd use Path.GetTempPath() and it would do the right thing.

    ASPNET_TEMP can be used to override if course.

    点赞 评论 复制链接分享
  • weixin_39810196 weixin_39810196 4月前

    I remember you mentioning that Path.GetTemppath is not used here to avoid falling back to userprofile. Are you okay if I just change code to use Path.GetTempPath and just check for %ASPNET_TEMP% before?

    点赞 评论 复制链接分享
  • weixin_39528843 weixin_39528843 4月前

    Ask

    点赞 评论 复制链接分享
  • weixin_39810196 weixin_39810196 4月前
    • I talked with on this. I think it is okay to use Path.GetTempPath as long as we check for ASPNET_TEMP first. I'll update the PR with this change.
    点赞 评论 复制链接分享
  • weixin_39729837 weixin_39729837 4月前

    :shipit:

    点赞 评论 复制链接分享

相关推荐