- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
GETLOG produces nothing on Linux when stdin is redirected.
$ cat main.f90
!===============================================================================
PROGRAM MAIN
USE IFPORT
CHARACTER(16) :: user
CALL GETLOG(user)
PRINT *, "User: ",user
END
!===============================================================================
$ ifort main.f90
$ ./a.out
User: fanning
$ ./a.out < /dev/null
User:
$ ifort -V
Intel(R) Fortran Compiler XE for applications running on IA-32, Version 15.0.5.223 Build 20150805
Copyright (C) 1985-2015 Intel Corporation. All rights reserved.
Also fails under:
Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.5.223 Build 20150805
Copyright (C) 1985-2015 Intel Corporation. All rights reserved.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your post. I will look into this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you again for reporting this and for the convenient reproducer. Turns out this is reproducible on IA32 Linux only. I submitted this to Development for investigation/repair.
(Internal tracking id: DPD200377513)
(Resolution Update on 05/26/2016): This defect is fixed in the Intel® Parallel Studio XE 2016 Update 3 Release (ifort Version 16.0.3.210 Build 20160415 - PSXE 2016.3.067 / CnL 2016.3.210- Linux)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Glad it's being looked into. However I do see it on both ia32 and intel64. Hopefully the fix will apply to both.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I see you noted that but I cannot reproduce this on intel64 even having tried multiple compilers. I will add a note in the internal tracking id to ensure Development is aware of your findings and ensure they consider that during their investigation.
What version of Linux do you use with intel64?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
$ uname -a
Linux <hostname> 2.6.18-406.el5 #1 SMP Tue Jun 2 17:25:57 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux
and
$ cat /etc/redhat-release
CentOS release 5.11 (Final)
Let me know if you need other information.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I did a little more experimentation, and the issue may reside within Linux, not Intel Fortran. For example:
$ cat getlogin.cc
#include <iostream>
#include <unistd.h>
int main()
{
std::cout << "Hello, World!" << std::endl;
std::cout << "Login: " << getlogin() << std::endl;
}
$ c++ getlogin.cc
$ ./a.out
Hello, World!
Login: <mylogin>
but
$ ./a.out < /dev/null
Hello, World!
Login: $ (No login presented. Prompt appears here.)
It turns out that when using input redirection, the system call "getlogin" returns NULL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Appreciate the added details/insight. I'll relay this to Development.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I confirmed this defect is fixed in the Intel® Parallel Studio XE 2016 Update 3 release available from the Intel® Software Development Products Registration Center (IRC). Thank you for reporting this. The underlying defect with our Fortran compiler did relate to calling getlogin. Also, my confirmation of this fix was on IA-32 only. I was never able to reproduce this on Intel® 64; however, the fix does apply to both.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thomas,
for portable code I recommend
call getenv ("LOGNAME", user)
instead of GETLOG.
Hope this helps,
Harald
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Or even more portable:
call GET_ENVIRONMENT_VARIABLE("LOGNAME",user)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page